Returns the app's raw password rules as an array

@param integer $iGroupId The group who's rules to fetch

@return array
775028
protected function getRules($iGroupId)
    {
        $sCacheKey    = 'password-rules-' . $iGroupId;
        $aCacheResult = $this->getCache($sCacheKey);
        if (!empty($aCacheResult)) {
            return $aCacheResult;
        }

        $oDb = Factory::service('Database');
        $oDb->select('password_rules');
        $oDb->where('id', $iGroupId);
        $oResult = $oDb->get(NAILS_DB_PREFIX . 'user_group');

        if ($oResult->num_rows() === 0) {
            return [];
        }

        $oPwRules = json_decode($oResult->row()->password_rules);

        $aOut                 = [];
        $aOut['min']          = !empty($oPwRules->min) ? $oPwRules->min : null;
        $aOut['max']          = !empty($oPwRules->max) ? $oPwRules->max : null;
        $aOut['expiresAfter'] = !empty($oPwRules->expiresAfter) ? $oPwRules->expiresAfter : null;
        $aOut['requirements'] = !empty($oPwRules->requirements) ? $oPwRules->requirements : [];
        $aOut['banned']       = !empty($oPwRules->banned) ? $oPwRules->banned : [];

        $this->setCache($sCacheKey, $aOut);

        return $aOut;
    }
958158
public function getCapabilitiesNameForGroup($groupID)
    {
        if (!array_key_exists($groupID, $this->groupIDCapabilitiesMap)) {
            throw new \InvalidArgumentException('The Group ID ' . $groupID . ' supplied does not exist');
        }

        return $this->groupIDCapabilitiesMap[$groupID];
    }
1115175
public function getPassword()
    {
        if (!array_key_exists(self::PASSWORD, $this->group)) {
            throw new \Exception('Could not get group password from group id.');
        }
        return $this->group[self::PASSWORD];
    }
88739
public static function getAllGroupUidList()
    {
        $data = static::select(array('uid','groups'));
        $group_uid_map = array();
        foreach ($data as $local_ip => $buffer_array) {
            foreach ($buffer_array as $local_port => $items) {
                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
                foreach ($items as $connection_id => $info) {
                    if (empty($info['uid']) || empty($info['groups'])) {
                        break;
                    }
                    $uid = $info['uid'];
                    foreach ($info['groups'] as $group_id) {
                        if(!isset($group_uid_map[$group_id])) {
                            $group_uid_map[$group_id] = array();
                        }
                        $group_uid_map[$group_id][$uid] = $uid;
                    }
                }
            }
        }
        return $group_uid_map;
    }
786614
public static function getClientIdListByGroup($group)
    {
        if (!static::isValidGroupId($group)) {
            return array();
        }

        $data = static::select(array('uid'), array('groups' => is_array($group) ? $group : array($group)));
        $client_id_map = array();
        foreach ($data as $local_ip => $buffer_array) {
            foreach ($buffer_array as $local_port => $items) {
                //$items = ['connection_id'=>['uid'=>x, 'group'=>[x,x..], 'session'=>[..]], 'client_id'=>[..], ..];
                foreach ($items as $connection_id => $info) {
                    $client_id = Context::addressToClientId($local_ip, $local_port, $connection_id);
                    $client_id_map[$client_id] = $client_id;
                }
            }
        }
        return $client_id_map;
    }
179689
public function getGroupAuthList($gid, $type = 1)
    {
        // 转换表名
        $auth_group = $this->config['auth_group'];
        $auth_rule = $this->config['auth_rule'];
        // 执行查询
        $rules = Db::name($auth_group)->where(['status'=>1, 'id'=>$gid])->value('rules');
        // 格式化access表id
        $ids = explode(',', trim($rules, ','));
        $ids = array_unique($ids);
        $map = array(
            'id' => ['in', $ids],
            'type' => $type,
            'status' => 1,
        );
        //读取用户组所有权限规则
        $rules = Db::name($auth_rule)->where($map)->column('title,name,condition');

        return $rules;
    }
168112
public function getAllPermissionPathsForGroup($groupId)
    {
        $groupPermissions = $this->find('all')
            ->select('path')
            ->where(['group_id' => $groupId])
            ->hydrate(false)
            ->toArray();

        return Hash::extract($groupPermissions, '{n}.path');
    }
563050
public function getGroupByGUID($guid, $attributes = [])
    {
        $searchLocations = $this->config()->groups_search_locations ?: [null];
        foreach ($searchLocations as $searchLocation) {
            $records = $this->getGateway()->getGroupByGUID($guid, $searchLocation, Ldap::SEARCH_SCOPE_SUB, $attributes);
            if ($records) {
                return $records[0];
            }
        }
    }
1357546
public function getCapabilitiesNameForGroup($groupID)
    {
        if (!array_key_exists($groupID, $this->_groupIDCapabilitiesMap)) {
            throw new WURFL_WURFLException("The Group ID " . $groupID . " supplied does not exist");
        }
        return $this->_groupIDCapabilitiesMap [$groupID];
    }
509115
public function getGroupPermissions($groupName)
    {
        if (!isset($this->config[$groupName])) {
            return [];
        }

        return array_keys($this->config[$groupName]['permissions']);
    }
31774
public function getRuleIds($uid){
        
        $groups = $this->getGroup($uid);
        
        $rules = [];
        foreach ($groups as $g){
            $rule = $g['rules'] ? explode(',', $g['rules']) : '';
            if ($rule){
                $rules = array_merge($rules , $rule);
            } 
        }
        
        return $rules;
    }
564464
public function groupUserGagList($groupId) {
        try{
            if(empty($groupId))
                throw new Exception('群组 Id 不能为空');
            $params['groupId'] = $groupId;
            $ret = $this->curl('/group/user/gag/list',$params);
            if(empty($ret))
                throw new Exception('请求失败');
            return $ret;
        }catch (Exception $e) {
            print_r($e->getMessage());
        }
    }
724914
public function findAllForGroup($groupId)
    {
        if (!$groupId) {
            return [];
        }

        if (!is_array($groupId)) {
            $groupId = [$groupId];
        }

        $cacheKey = join('_', $groupId);

        $permissions = Cache::remember($cacheKey, function () use ($groupId) {
            return $this
                ->find('list', [
                    'keyField' => 'path',
                    'valueField' => 'allowed'
                ])
                ->where([
                    'group_id IN' => $groupId,
                    'allowed >' => 0
                ])
                ->order('allowed DESC')
                ->hydrate(false)
                ->toArray();
        }, 'wasabi/core/group_permissions');

        return $permissions;
    }
324111
public function getCountsUsersByGroups(array $groupIds) {
        array_walk($groupIds, function(&$item) {$item = new \MongoId($item);});
        $qa = $this->createAggregationQuery();
        $qa->project(array('_id' => 0, 'groups' => 1));
        $qa->unwind('$groups');
        $qa->match(array('groups.$id' => array('$in' => $groupIds)));
        $qa->group(array('_id' => '$groups', 'sum' => array('$sum' => 1)));
        $qa->project(array('_id' => 0, 'groups' => '$_id', 'sum' => 1));

        $aggregateGroupUsers = $qa->getQuery()->aggregate()->toArray();
        $nbrGroupsUsers = array();
        array_walk($aggregateGroupUsers, function($item) use (&$nbrGroupsUsers) {
            $groupId = $item['groups']['$id']->{'$id'};
            $nbrGroupsUsers[$groupId] = $item['sum'];
        });

        return array_merge(array_combine($groupIds, array_fill(0, count($groupIds), 0)), $nbrGroupsUsers);
    }
1140732
public function getPasswordResetTokenRules()
    {
        if (!is_string($this->passwordResetTokenAttribute) || empty($this->passwordResetTokenAttribute)) {
            return [];
        }
        if (empty($this->passwordResetTokenRules) || !is_array($this->passwordResetTokenRules)) {
            $this->passwordResetTokenRules = [
                [[$this->passwordResetTokenAttribute], 'string', 'length' => 40],
                [[$this->passwordResetTokenAttribute], 'unique'],
            ];
        }
        return $this->passwordResetTokenRules;
    }
496935
public function getGroups($uid) {
        static $groups = array();
        if (isset($groups[$uid]))
            return $groups[$uid];
        $user_groups = M()
            ->table($this->_config['AUTH_GROUP_ACCESS'] . ' a')
            ->where("a.uid='$uid' and g.status='1'")
            ->join($this->_config['AUTH_GROUP']." g on a.group_id=g.id")
            ->field('uid,group_id,title,rules')->select();
        $groups[$uid]=$user_groups?:array();
        return $groups[$uid];
    }
422068
protected function identifierToGroupID($groupID)
    {
        if (is_numeric($groupID) && Group::get()->byID($groupID)) {
            return $groupID;
        } elseif (is_string($groupID) && $groupByCode = Group::get()->filter(['Code' => $groupID])->first()) {
            return $groupByCode->ID;
        } elseif ($groupID instanceof Group && $groupID->exists()) {
            return $groupID->ID;
        }
        return null;
    }