本文整理汇总了PHP中UserGroup::id方法的典型用法代码示例。如果您正苦于以下问题:PHP UserGroup::id方法的具体用法?PHP UserGroup::id怎么用?PHP UserGroup::id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserGroup
的用法示例。
在下文中一共展示了UserGroup::id方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: test_id
public function test_id()
{
$group = UserGroup::get("new test group");
$this->assert_equal(UserGroup::id("new test group"), $group->id, 'Cannot retrieve "new test group" by name.');
$this->assert_equal(UserGroup::id($group->id), $group->id, 'Cannot retrieve "new test group" by ID.');
$this->assert_false(UserGroup::id("nonexistent test group"), 'Retrieved an ID for an invalid group name.');
$this->assert_false(UserGroup::id(-1), 'Retrieved a ID for an invalid group ID.');
}
示例2: in_group
/**
* function in_group
* Whether or not this user is is in the specified group
* @param int $group a group ID or name
* @return bool Whether or not this user is in the specified group
**/
public function in_group($group)
{
$groups = $this->list_groups();
return in_array(UserGroup::id($group), $groups);
}
示例3: get_group_token_access
/**
* Get the access bitmask of a group for a specific permission token
* @param integer $group The group ID
* @param mixed $token_id A permission name or ID
* @return an access bitmask
*/
public static function get_group_token_access($group, $token_id)
{
// Use only numeric ids internally
$group = UserGroup::id($group);
$token_id = self::token_id($token_id);
$sql = 'SELECT access_mask FROM {group_token_permissions} WHERE
group_id=? AND token_id=?;';
$result = DB::get_value($sql, array($group, $token_id));
if (isset($result)) {
return self::get_bitmask($result);
}
return null;
}