mirror of
https://github.com/rsyslog/loganalyzer.git
synced 2025-09-25 18:59:12 +02:00
Fixed BUGID 375, user and group data is now deleted when removing them using the admin panel.
This commit is contained in:
parent
61d66a8543
commit
65f3431275
@ -281,17 +281,15 @@ if ( isset($_GET['op']) )
|
|||||||
}
|
}
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
// do the delete!
|
// Delete User objects!
|
||||||
$result = DB_Query( "DELETE FROM " . DB_GROUPS . " WHERE ID = " . $content['GROUPID'] );
|
PerformSQLDelete( "DELETE FROM " . DB_SOURCES . " WHERE groupid = " . $content['GROUPID'], 'LN_SOURCES_ERROR_DELSOURCE', $content['GROUPID'] );
|
||||||
if ($result == FALSE)
|
PerformSQLDelete( "DELETE FROM " . DB_VIEWS . " WHERE groupid = " . $content['GROUPID'], 'LN_VIEWS_ERROR_DELSEARCH', $content['GROUPID'] );
|
||||||
{
|
PerformSQLDelete( "DELETE FROM " . DB_SEARCHES . " WHERE groupid = " . $content['GROUPID'], 'LN_SEARCH_ERROR_DELSEARCH', $content['GROUPID'] );
|
||||||
$content['ISERROR'] = true;
|
PerformSQLDelete( "DELETE FROM " . DB_CHARTS . " WHERE groupid = " . $content['GROUPID'], 'LN_CHARTS_ERROR_DELCHART', $content['GROUPID'] );
|
||||||
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_GROUP_ERROR_DELGROUP'], $content['USERID'] );
|
PerformSQLDelete( "DELETE FROM " . DB_GROUPMEMBERS . " WHERE groupid = " . $content['GROUPID'], 'LN_GROUP_ERROR_REMUSERFROMGROUP', $content['GROUPID'] );
|
||||||
}
|
|
||||||
else
|
// Finally delete the Groupobject!
|
||||||
DB_FreeQuery($result);
|
PerformSQLDelete( "DELETE FROM " . DB_GROUPS . " WHERE ID = " . $content['GROUPID'], 'LN_GROUP_ERROR_DELGROUP', $content['GROUPID'] );
|
||||||
|
|
||||||
// TODO: DELETE GROUP SETTINGS, GROUP MEMBERSHIP ...
|
|
||||||
|
|
||||||
// Do the final redirect
|
// Do the final redirect
|
||||||
RedirectResult( GetAndReplaceLangStr( $content['LN_GROUP_ERROR_HASBEENDEL'], $myrow['groupname'] ) , "groups.php" );
|
RedirectResult( GetAndReplaceLangStr( $content['LN_GROUP_ERROR_HASBEENDEL'], $myrow['groupname'] ) , "groups.php" );
|
||||||
@ -495,6 +493,23 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
|
|||||||
else
|
else
|
||||||
$content['EMPTYGROUPS'] = "true";
|
$content['EMPTYGROUPS'] = "true";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to delete SQL Data
|
||||||
|
function PerformSQLDelete( $szDeleteStm, $szErrMsg, $szUserID)
|
||||||
|
{
|
||||||
|
global $content;
|
||||||
|
$result = DB_Query( $szDeleteStm );
|
||||||
|
if ($result == FALSE)
|
||||||
|
{
|
||||||
|
$content['ISERROR'] = true;
|
||||||
|
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content[$szErrMsg], $szUserID );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DB_FreeQuery($result);
|
||||||
|
// Success
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// --- END Custom Code
|
// --- END Custom Code
|
||||||
|
|
||||||
// --- BEGIN CREATE TITLE
|
// --- BEGIN CREATE TITLE
|
||||||
|
@ -260,18 +260,15 @@ if ( isset($_GET['op']) )
|
|||||||
PrintSecureUserCheck( GetAndReplaceLangStr( $content['LN_USER_WARNDELETEUSER'], $myrow['username'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] );
|
PrintSecureUserCheck( GetAndReplaceLangStr( $content['LN_USER_WARNDELETEUSER'], $myrow['username'] ), $content['LN_DELETEYES'], $content['LN_DELETENO'] );
|
||||||
}
|
}
|
||||||
// ---
|
// ---
|
||||||
|
|
||||||
|
// Delete User objects!
|
||||||
|
PerformSQLDelete( "DELETE FROM " . DB_SOURCES . " WHERE userid = " . $content['USERID'], 'LN_SOURCES_ERROR_DELSOURCE', $content['USERID'] );
|
||||||
|
PerformSQLDelete( "DELETE FROM " . DB_VIEWS . " WHERE userid = " . $content['USERID'], 'LN_VIEWS_ERROR_DELSEARCH', $content['USERID'] );
|
||||||
|
PerformSQLDelete( "DELETE FROM " . DB_SEARCHES . " WHERE userid = " . $content['USERID'], 'LN_SEARCH_ERROR_DELSEARCH', $content['USERID'] );
|
||||||
|
PerformSQLDelete( "DELETE FROM " . DB_CHARTS . " WHERE userid = " . $content['USERID'], 'LN_CHARTS_ERROR_DELCHART', $content['USERID'] );
|
||||||
|
|
||||||
// do the delete!
|
// Finally delete the Userobject!
|
||||||
$result = DB_Query( "DELETE FROM " . DB_USERS . " WHERE ID = " . $content['USERID'] );
|
PerformSQLDelete( "DELETE FROM " . DB_USERS . " WHERE ID = " . $content['USERID'], 'LN_USER_ERROR_DELUSER', $content['USERID'] );
|
||||||
if ($result == FALSE)
|
|
||||||
{
|
|
||||||
$content['ISERROR'] = true;
|
|
||||||
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content['LN_USER_ERROR_DELUSER'], $content['USERID'] );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
DB_FreeQuery($result);
|
|
||||||
|
|
||||||
// TODO: DELETE PERSONAL SETTINGS, GROUP MEMBERSHIP ...
|
|
||||||
|
|
||||||
// Do the final redirect
|
// Do the final redirect
|
||||||
RedirectResult( GetAndReplaceLangStr( $content['LN_USER_ERROR_HASBEENDEL'], $myrow['username'] ) , "users.php" );
|
RedirectResult( GetAndReplaceLangStr( $content['LN_USER_ERROR_HASBEENDEL'], $myrow['username'] ) , "users.php" );
|
||||||
@ -455,6 +452,23 @@ if ( !isset($_POST['op']) && !isset($_GET['op']) )
|
|||||||
}
|
}
|
||||||
// ---
|
// ---
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function to delete SQL Data
|
||||||
|
function PerformSQLDelete( $szDeleteStm, $szErrMsg, $szUserID)
|
||||||
|
{
|
||||||
|
global $content;
|
||||||
|
$result = DB_Query( $szDeleteStm );
|
||||||
|
if ($result == FALSE)
|
||||||
|
{
|
||||||
|
$content['ISERROR'] = true;
|
||||||
|
$content['ERROR_MSG'] = GetAndReplaceLangStr( $content[$szErrMsg], $szUserID );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
DB_FreeQuery($result);
|
||||||
|
// Success
|
||||||
|
return true;
|
||||||
|
}
|
||||||
// --- END Custom Code
|
// --- END Custom Code
|
||||||
|
|
||||||
// --- BEGIN CREATE TITLE
|
// --- BEGIN CREATE TITLE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user