本文整理汇总了PHP中auth_admin::get_role_mask方法的典型用法代码示例。如果您正苦于以下问题:PHP auth_admin::get_role_mask方法的具体用法?PHP auth_admin::get_role_mask怎么用?PHP auth_admin::get_role_mask使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类auth_admin
的用法示例。
在下文中一共展示了auth_admin::get_role_mask方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
/**
* Remove role
*/
function remove_role($role_id, $permission_type)
{
global $db;
$auth_admin = new auth_admin();
// Get complete auth array
$sql = 'SELECT auth_option, auth_option_id
FROM ' . ACL_OPTIONS_TABLE . "\n\t\t\tWHERE auth_option " . $db->sql_like_expression($permission_type . $db->any_char);
$result = $db->sql_query($sql);
$auth_settings = array();
while ($row = $db->sql_fetchrow($result)) {
$auth_settings[$row['auth_option']] = ACL_NO;
}
$db->sql_freeresult($result);
// Get the role auth settings we need to re-set...
$sql = 'SELECT o.auth_option, r.auth_setting
FROM ' . ACL_ROLES_DATA_TABLE . ' r, ' . ACL_OPTIONS_TABLE . ' o
WHERE o.auth_option_id = r.auth_option_id
AND r.role_id = ' . $role_id;
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result)) {
$auth_settings[$row['auth_option']] = $row['auth_setting'];
}
$db->sql_freeresult($result);
// Get role assignments
$hold_ary = $auth_admin->get_role_mask($role_id);
// Re-assign permissions
foreach ($hold_ary as $forum_id => $forum_ary) {
if (isset($forum_ary['users'])) {
$auth_admin->acl_set('user', $forum_id, $forum_ary['users'], $auth_settings, 0, false);
}
if (isset($forum_ary['groups'])) {
$auth_admin->acl_set('group', $forum_id, $forum_ary['groups'], $auth_settings, 0, false);
}
}
// Remove role from users and groups just to be sure (happens through acl_set)
$sql = 'DELETE FROM ' . ACL_USERS_TABLE . '
WHERE auth_role_id = ' . $role_id;
$db->sql_query($sql);
$sql = 'DELETE FROM ' . ACL_GROUPS_TABLE . '
WHERE auth_role_id = ' . $role_id;
$db->sql_query($sql);
// Remove role data and role
$sql = 'DELETE FROM ' . ACL_ROLES_DATA_TABLE . '
WHERE role_id = ' . $role_id;
$db->sql_query($sql);
$sql = 'DELETE FROM ' . ACL_ROLES_TABLE . '
WHERE role_id = ' . $role_id;
$db->sql_query($sql);
$auth_admin->acl_clear_prefetch();
}