當前位置: 首頁>>代碼示例>>PHP>>正文


PHP auth_admin::get_role_mask方法代碼示例

本文整理匯總了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();
    }
開發者ID:ALTUN69,項目名稱:icy_phoenix,代碼行數:53,代碼來源:class_cms_permissions_roles.php


注:本文中的auth_admin::get_role_mask方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。