当前位置: 首页>>代码示例>>PHP>>正文


PHP permissions::getGroupInfo方法代码示例

本文整理汇总了PHP中permissions::getGroupInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP permissions::getGroupInfo方法的具体用法?PHP permissions::getGroupInfo怎么用?PHP permissions::getGroupInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在permissions的用法示例。


在下文中一共展示了permissions::getGroupInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateUser

 /**
  * Изменить информацию о группах и правах пользователя
  *
  * @param   integer     $uid                ID пользователя
  * @param   array       $groups             Информация о группах
  * @param   array       $rights_allow       Информация о разрешенных правах
  */
 function updateUser($uid, $groups, $rights_allow)
 {
     global $DB;
     $user_groups_rights = array();
     if (!is_array($rights_allow)) {
         $rights_allow = array();
     }
     if (!is_array($rights_disallow)) {
         $rights_disallow = array();
     }
     $sql = "DELETE FROM permissions_groups_users WHERE user_id=?i";
     $DB->query($sql, $uid);
     $sql = "DELETE FROM permissions_rights_users WHERE user_id=?i";
     $DB->query($sql, $uid);
     if (is_array($groups)) {
         $sql = "";
         if ($groups) {
             foreach ($groups as $group) {
                 $g_rights = permissions::getGroupInfo($group);
                 if ($g_rights['rights']) {
                     foreach ($g_rights['rights'] as $g_right) {
                         if (!in_array($g_right, $user_groups_rights)) {
                             array_push($user_groups_rights, $g_right);
                         }
                     }
                 }
                 $sql .= "INSERT INTO permissions_groups_users(group_id,user_id) VALUES({$group},{$uid});\n ";
             }
             $DB->query($sql);
             $DB->query("UPDATE users SET is_chuck = true WHERE uid = {$uid}");
         }
     }
     $tr_allow = array_diff($rights_allow, $user_groups_rights);
     $tr_disallow = array_diff($user_groups_rights, $rights_allow);
     $rights_allow = $tr_allow;
     $rights_disallow = $tr_disallow;
     if (is_array($rights_allow)) {
         $sql = "";
         if ($rights_allow) {
             foreach ($rights_allow as $right) {
                 $sql .= "INSERT INTO permissions_rights_users(right_id,user_id,is_allow) VALUES({$right},{$uid},'t');\n ";
             }
             $DB->query($sql);
         }
     }
     if (is_array($rights_disallow)) {
         $sql = "";
         if ($rights_disallow) {
             foreach ($rights_disallow as $right) {
                 $sql .= "INSERT INTO permissions_rights_users(right_id,user_id,is_allow) VALUES({$right},{$uid},'f');\n ";
             }
             $DB->query($sql);
         }
     }
 }
开发者ID:amage,项目名称:fl-ru-damp,代码行数:62,代码来源:permissions.php

示例2: __paramInit

 $user_id = __paramInit('int', 'uid', 'uid');
 require_once $_SERVER['DOCUMENT_ROOT'] . '/classes/users.php';
 $user = new users();
 $user->GetUserByUID($user_id);
 $groups = permissions::getAllGroups();
 foreach ($groups as $k => $group) {
     $g_rights = permissions::getGroupInfo($group['id']);
     $groups[$k]['rights'] = $g_rights['rights'];
 }
 $rights = permissions::getAllRights();
 $user_groups_data = permissions::getUserGroups($user_id);
 $user_groups = array();
 $user_groups_rights = array();
 foreach ($user_groups_data as $user_group) {
     array_push($user_groups, $user_group['id']);
     $g_rights = permissions::getGroupInfo($user_group['id']);
     if ($g_rights['rights']) {
         foreach ($g_rights['rights'] as $g_right) {
             if (!in_array($g_right, $user_groups_rights)) {
                 array_push($user_groups_rights, $g_right);
             }
         }
     }
 }
 $user_rights_data = permissions::getUserExtraRights($user_id);
 $user_rights_allow = array();
 $user_rights_disallow = array();
 foreach ($user_rights_data as $user_right) {
     if ($user_right['is_allow'] == 't') {
         array_push($user_rights_allow, $user_right['id']);
     } else {
开发者ID:kapai69,项目名称:fl-ru-damp,代码行数:31,代码来源:index.php


注:本文中的permissions::getGroupInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。