Hey Everyone:
If you're running or know DNN for YAF, I have this pressing issue that I need a bit of help with. Thanks in advance! :)
https://yetanotherforum.n...elete-Superusers-Now
Aha! I should've thought to search through the sprocs. You were correct about this. The RemoveUsers procedure was modified. This is a core code change. Had I known this was happening, I wouldn't have ever even tried using this module. :(
It was the only sproc that had the term <code>yaf</code> in it. I used these queries to find it:
<code>SELECT OBJECT_NAME(object_id)<br /> FROM sys.sql_modules<br /> WHERE OBJECTPROPERTY(object_id, 'IsProcedure') = 1<br /> AND definition LIKE '%yaf%'</code>
<code>SELECT OBJECT_NAME(id) <br /> FROM SYSCOMMENTS <br /> WHERE [text] LIKE '%yaf%' <br /> AND OBJECTPROPERTY(id, 'IsProcedure') = 1 <br /> GROUP BY OBJECT_NAME(id)</code>
<code>SELECT ROUTINE_NAME, ROUTINE_DEFINITION<br /> FROM INFORMATION_SCHEMA.ROUTINES <br /> WHERE ROUTINE_DEFINITION LIKE '%yaf%' <br /> AND ROUTINE_TYPE='PROCEDURE'</code>
I used a clean instance of DNN 9.12 (same version) to drop and recreate the sproc:
<code>/****** Object: StoredProcedure [dbo].[RemoveUser] Script Date: 8/31/2023 9:07:40 AM ******/<br /> DROP PROCEDURE [dbo].[RemoveUser]<br /> GO</code>
<code>/****** Object: StoredProcedure [dbo].[RemoveUser] Script Date: 8/31/2023 9:07:40 AM ******/<br /> SET ANSI_NULLS ON<br /> GO</code>
<code>SET QUOTED_IDENTIFIER ON<br /> GO</code>
<code>CREATE PROCEDURE [dbo].[RemoveUser]<br /> @UserID int,<br /> @PortalID int<br /> AS<br /> IF @PortalID IS NULL<br /> BEGIN<br /> -- Delete SuperUser<br /> DELETE FROM dbo.Users<br /> WHERE UserId = @UserID<br /> END<br /> ELSE<br /> BEGIN<br /> -- Remove User from Portal<br /> DELETE FROM dbo.UserPortals<br /> WHERE UserId = @UserID<br /> AND PortalId = @PortalID<br /> IF NOT EXISTS (SELECT 1 FROM dbo.UserPortals WHERE UserId = @UserID)<br /> -- Delete User (but not if SuperUser)<br /> BEGIN<br /> DELETE FROM dbo.Users<br /> WHERE UserId = @UserID<br /> AND IsSuperUser = 0<br /> DELETE FROM dbo.UserRoles<br /> WHERE UserID = @UserID<br /> END<br /> ELSE<br /> BEGIN<br /> DELETE ur FROM dbo.UserRoles ur<br /> INNER JOIN dbo.Roles r ON r.RoleID = ur.RoleID<br /> WHERE UserID = @UserID AND r.PortalID = @PortalID<br /> END<br /> END<br /> GO</code>
These are superusers I'm attempting to permanently remove, so far. They're already marked as deleted, but I still can't use the option in the Users view to "Permanently Delete." I get a new error, listed below. However, an interesting thing to note is that running the <code>purge- user</code> prompt command doesn't display any error at all. If I took that for it's word, the same user accounts I'm trying to delete are deleted, but they're still there.
ERROR MESSAGE
<code>Message:Internal Query Processor Error: The query processor encountered an unexpected error during execution (HRESULT = 0x80040e19).</code>
<code>StackTrace:</code>
<code> at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)<br /> at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)<br /> at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)<br /> at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString, Boolean isInternal, Boolean forDescribeParameterEncryption, Boolean shouldCacheForAlwaysEncrypted)<br /> at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)<br /> at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)<br /> at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)<br /> at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()<br /> at PetaPoco.Database.<>c.<ExecuteNonQueryHelper>b__353_0(IDbCommand c)<br /> at PetaPoco.Database.CommandHelper(IDbCommand cmd, Func`2 cmdFunc)<br /> at PetaPoco.Database.ExecuteNonQueryHelper(IDbCommand cmd)<br /> at PetaPoco.Database.ExecuteInternal(CommandType commandType, String sql, Object[] args)<br /> at DotNetNuke.Data.PetaPoco.PetaPocoHelper.ExecuteNonQuery(String connectionString, CommandType type, Int32 timeoutSec, String sql, Object[] args)<br /> at DotNetNuke.Data.SqlDataProvider.ExecuteNonQuery(String procedureName, Object[] commandParameters)<br /> at DotNetNuke.Security.Membership.AspNetMembershipProvider.RemoveUser(UserInfo user)</code>
This means that there are likely MORE core code changes that were made. Ugh...
These Forums are for the discussion of the open source CMS DNN platform and ecosystem.
For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:
Awesome! Simply post in the forums using the link below and we'll get you started.