Returns the app's password rules as a formatted string

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

@return string
19493
public function getRulesAsString($iGroupId)
    {
        $aRules = $this->getRulesAsArray($iGroupId);

        if (empty($aRules)) {
            return '';
        }

        $sStr = 'Passwords must ' . strtolower(implode(', ', $aRules)) . '.';
        return str_lreplace(', ', ' and ', $sStr);
    }
1261476
public function isExpired($iUserId)
    {
        if (empty($iUserId)) {
            return false;
        }

        $oDb = Factory::service('Database');
        $oDb->select('u.password_changed,ug.password_rules');
        $oDb->where('u.id', $iUserId);
        $oDb->join(NAILS_DB_PREFIX . 'user_group ug', 'ug.id = u.group_id');
        $oDb->limit(1);
        $oResult = $oDb->get(NAILS_DB_PREFIX . 'user u');

        if ($oResult->num_rows() !== 1) {
            return false;
        }

        //  Decode the password rules
        $oGroupPwRules = json_decode($oResult->row()->password_rules);

        if (empty($oGroupPwRules->expiresAfter)) {
            return false;
        }

        $sChanged = $oResult->row()->password_changed;

        if (is_null($sChanged)) {

            return true;

        } else {

            $oThen     = new \DateTime($sChanged);
            $oNow      = new \DateTime();
            $oInterval = $oNow->diff($oThen);

            return $oInterval->days >= $oGroupPwRules->expiresAfter;
        }
    }
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;
    }
911910
public function getPassword($uuid)
	{
		if($this->entries != null)
		{
			foreach($this->entries as &$entry)
			{
				if($entry->uuid === $uuid)
					return $entry->password;
			}
		}
		if($this->groups != null)
		{
			foreach($this->groups as &$group)
			{
				$value = $group->getPassword($uuid);
				if($value != null)
					return $value;
			}
		}
		return null;
	}
684215
public function getPassword($uuid)
	{
		if($this->_groups != null)
		{
			foreach($this->_groups as &$group)
			{
				$value = $group->getPassword($uuid);
				if($value != null)
					return $value->getPlainString();
			}
		}
		return null;
	}
1071297
public function getGroup(string $groupid)
    {
        $cl = $this->getGroupClass();
        $group = new $cl;
        return $group->obtainByGroupID($groupid);
    }
548860
public function loadGroup($groupId)
    {
        $groups = $this->mapper->extractGroupsFromRows(
            $this->contentTypeGateway->loadGroupData([$groupId])
        );

        if (count($groups) !== 1) {
            throw new Exception\TypeGroupNotFound($groupId);
        }

        return $groups[0];
    }
1319339
public static function &GetAvailableMethods($iGroupId)
    {
        $query = self::getAvailableMethodsQuery($iGroupId);
        $oList = &TdbShopPaymentMethodList::GetList($query);
        $oList->bAllowItemCache = true;
        $oList->RemoveInvalidItems();

        return $oList;
    }
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;
    }
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];
    }
1235957
public function toString()
    {
        $credentials = array();
        $credentials['AppID'] = $this->appId;
        $credentials['AppKey'] = $this->appKey;
        $credentials['AuthorizationCode'] = $this->appKey;
        return implode(' - ', $credentials);
    }
842043
public function retrieveGroupOwners($groupId)
    {
        $uri  = self::APPS_BASE_FEED_URI . self::APPS_GROUP_PATH . '/';
        $uri .= $this->getDomain() . '/' . $groupId . '/owner';

        return $this->getOwnerFeed($uri);
    }
619340
public function getGroups($uid)
    {
        static $groups = [];
        if (isset($groups[$uid])) {
            return $groups[$uid];
        }
        // 转换表名
        $type = Config::get('database.prefix') ? 1 : 0;
        $auth_group_access = Loader::parseName($this->config['auth_group_access'], $type);
        $auth_group = Loader::parseName($this->config['auth_group'], $type);
        // 执行查询
        $user_groups = Db::view($auth_group_access, 'uid,group_id')
            ->view($auth_group, 'title,rules', "{$auth_group_access}.group_id={$auth_group}.id", 'LEFT')
            ->where("{$auth_group_access}.uid='{$uid}' and {$auth_group}.status='1'")
            ->select();
        $groups[$uid] = $user_groups ?: [];

        return $groups[$uid];
    }
1223269
public function fetchGroupMembers($groupId)
    {
        $result = $this->_get($this->_groupUrl($groupId, '/members'));
        return Deserialize::groupMembers($result);
    }
725232
public static function get_group_members($groupids) {
        $members = array();

        $params = self::validate_parameters(self::get_group_members_parameters(), array('groupids'=>$groupids));

        foreach ($params['groupids'] as $groupid) {
            // validate params
            $group = groups_get_group($groupid, 'id, courseid, name, enrolmentkey', MUST_EXIST);
            // now security checks
            $context = context_course::instance($group->courseid, IGNORE_MISSING);
            try {
                self::validate_context($context);
            } catch (Exception $e) {
                $exceptionparam = new stdClass();
                $exceptionparam->message = $e->getMessage();
                $exceptionparam->courseid = $group->courseid;
                throw new moodle_exception('errorcoursecontextnotvalid' , 'webservice', '', $exceptionparam);
            }
            require_capability('moodle/course:managegroups', $context);

            $groupmembers = groups_get_members($group->id, 'u.id', 'lastname ASC, firstname ASC');

            $members[] = array('groupid'=>$groupid, 'userids'=>array_keys($groupmembers));
        }

        return $members;
    }
1132964
static function passwordHashTypeName( $id )
    {
        switch ( $id )
        {
            case self::PASSWORD_HASH_EMPTY:
            {
                return 'empty';
            } break;
            case self::PASSWORD_HASH_MD5_PASSWORD:
            {
                return 'md5_password';
            } break;
            case self::PASSWORD_HASH_MD5_USER:
            {
                return 'md5_user';
            } break;
            case self::PASSWORD_HASH_MD5_SITE:
            {
                return 'md5_site';
            } break;
            case self::PASSWORD_HASH_MYSQL:
            {
                return 'mysql';
            } break;
            case self::PASSWORD_HASH_PLAINTEXT:
            {
                return 'plaintext';
            } break;
            case self::PASSWORD_HASH_BCRYPT:
            {
                return 'bcrypt';
            } break;
            case self::PASSWORD_HASH_PHP_DEFAULT:
            {
                return 'php_default';
            } break;
        }
    }
687818
public function deleteGroup($groupId)
    {
        return $this->auth(function () use ($groupId) {
            return $this->http->postJson(
                $this->baseUrl . 'cgi-bin/groups/delete?access_token=' . $this->accessToken,
                json_encode(
                    [
                        'group' => [
                            'id' => $groupId,
                        ],
                    ],
                    JSON_UNESCAPED_UNICODE
                )
            );
        });
    }