Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.
Changing User Role Problem
This discussion has been closed.
Comments
It will boot people back to the index if they attempt to change the role of someone of equal priority or otherwise it will cut off the roles from the drop-down menu which are of a higher or equal priority to the user's rank.
It can be circumvented by fabricating your own form data to send but I don't intend to close that security hole unless someone really, really wants me to. Anyway, here's the code and I'll package it as an extension if there's enough interest:
function WoWGF_FixRoleList($form) { $Context = $form -> Context; $Other = $form -> User; if(!$form -> IsPostBack) return; $sql = " SELECT `RoleID` FROM `{$Context->Configuration['DATABASE_TABLE_PREFIX']}User` WHERE `UserID`='{$Context->Session->UserID}' "; $data = $Context -> Database -> Execute($sql, '', '', ''); $rid = mysql_result($data, 0, 'RoleID'); if($rid == 4) return; // Don't cripple the administrator's privileges $sql = " SELECT * FROM `{$Context->Configuration['DATABASE_TABLE_PREFIX']}Role` "; $data = $Context -> Database -> Execute($sql, '', '', ''); while($row = mysql_fetch_assoc($data)) $priorities[$row['RoleID']] = $row['Priority']; if($priorities[$rid] <= $priorities[$Other -> RoleID]) { Redirect(GetUrl($Context -> Configuration, '.')); exit; } foreach($priorities as $roleID => $priority) { if($priority >= $priorities[$rid]) $form -> RoleSelect -> RemoveOption($roleID); } } $Context -> AddToDelegate('AccountRoleForm', 'Constructor', 'WoWGF_FixRoleList');
I don't really check this community much as I'm pretty new to Vanilla but Ben mentioned he'd created this topic and there was some discussion. Since I had this lying around I thought I might as well throw it in here. Anyway, point is, if you need to contact me your best bet is email.
// Ensure the user is allowed to view this page (they must have at least one of the following permissions) $RequiredPermissions = array('PERMISSION_CHECK_FOR_UPDATES', 'PERMISSION_APPROVE_APPLICANTS', 'PERMISSION_MANAGE_REGISTRATION', 'PERMISSION_ADD_ROLES', 'PERMISSION_EDIT_ROLES', 'PERMISSION_REMOVE_ROLES', 'PERMISSION_ADD_CATEGORIES', 'PERMISSION_EDIT_CATEGORIES', 'PERMISSION_REMOVE_CATEGORIES', 'PERMISSION_SORT_CATEGORIES', 'PERMISSION_CHANGE_APPLICATION_SETTINGS', 'PERMISSION_MANAGE_EXTENSIONS', 'PERMISSION_MANAGE_LANGUAGE', 'PERMISSION_MANAGE_STYLES', 'PERMISSION_MANAGE_THEMES');