PHP 클래스 RoleModel, vanilla

This file is part of Garden. Garden is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Garden is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Garden. If not, see . Contact Vanilla Forums Inc. at support [at] vanillaforums [dot] com
상속: extends Gdn_Model
파일 보기 프로젝트 열기: vanilla/vanilla 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$RankPermissions A list of permissions that define an increasing ranking of permissions.
$Roles All roles.

공개 메소드들

메소드 설명
__construct ( ) Class constructor. Defines the related database table name.
cleanUserRoles ( ) Enforce integrity between users and roles.
clearCache ( ) Clear the roles cache.
define ( $Values ) Define a role.
delete ( $where = [], $options = [] )
deleteAndReplace ( integer $roleID, integer $newRoleID ) : boolean Delete a role.
deleteID ( integer $roleID, array $options = [] ) : boolean Delete a role.
filterPersonalInfo ( $Role ) : boolean Use with array_filter to remove PersonalInfo roles.
get ( $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $PageNumber = false ) Returns a resultset of all roles.
getAllDefaultRoles ( ) : array Get the default role IDs for all types of roles.
getApplicantCount ( boolean $Force = false ) : integer Get the current number of applicants waiting to be approved.
getArray ( ) : array Returns an array of RoleID => RoleName pairs.
getAssignable ( ) : array Get the roles that the current user is allowed to assign to another user.
getByName ( array | string $Names, &$Missing = null ) Get a role by name.
getByNotRoleID ( $RoleID ) Returns a resultset of role data NOT related to the specified RoleID.
getByPermission ( $Permission ) Retrieves all roles with the specified permission(s).
getByRoleID ( $RoleID ) Returns a resultset of role data related to the specified RoleID.
getByType ( string $type ) : Gdn_DataSet Return all roles matching a specific type.
getByUserID ( integer $userID ) : Gdn_DataSet Get the roles for a user.
getCategoryPermissions ( integer $roleID ) : array Get the category specific permissions for a role.
getDefaultRoles ( string $type ) : array Get the default role IDs for a type of role.
getDefaultTypes ( boolean $translate = true ) : array Get an array of default role types.
getPermissions ( integer | array $RoleID ) : array Get the permissions for one or more roles.
getPublicUserRoles ( $userID, string $field = "Name" ) : array | null | void Get a list of a user's roles that are permitted to be seen.
getUserCount ( $RoleID, $UsersOnlyWithThisRole = false ) Returns the number of users assigned to the provided RoleID. If $UsersOnlyWithThisRole is TRUE, it will return the number of users who are assigned to this RoleID and NO OTHER.
getWithRankPermissions ( ) : Gdn_DataSet Get all of the roles including their ranking permissions.
roles ( null $RoleID = null, boolean $Force = false ) : array | mixed | null | type
save ( array $FormPostValues, array | false $Settings = false ) : boolean | mixed Save role data.
setUserRoles ( &$Users, string $UserIDColumn = 'UserID', string $RolesColumn = 'Roles' )

메소드 상세

__construct() 공개 메소드

Class constructor. Defines the related database table name.
public __construct ( )

cleanUserRoles() 공개 정적인 메소드

Enforce integrity between users and roles.
public static cleanUserRoles ( )

clearCache() 공개 메소드

Clear the roles cache.
public clearCache ( )

define() 공개 메소드

Define a role.
public define ( $Values )
$Values

delete() 공개 메소드

public delete ( $where = [], $options = [] )

deleteAndReplace() 공개 메소드

Delete a role.
public deleteAndReplace ( integer $roleID, integer $newRoleID ) : boolean
$roleID integer The ID of the role to delete.
$newRoleID integer Assign users of the deleted role to this new role.
리턴 boolean Returns **true** on success or **false** on failure.

deleteID() 공개 메소드

Delete a role.
public deleteID ( integer $roleID, array $options = [] ) : boolean
$roleID integer The ID of the role to delete.
$options array An array of options to affect the behavior of the delete. - **newRoleID**: The new role to point users to.
리턴 boolean Returns **true** on success or **false** otherwise.

filterPersonalInfo() 공개 정적인 메소드

Use with array_filter to remove PersonalInfo roles.
public static filterPersonalInfo ( $Role ) : boolean
리턴 boolean Whether role is NOT personal info (FALSE = remove it, it's personal).

get() 공개 메소드

Returns a resultset of all roles.
public get ( $OrderFields = '', $OrderDirection = 'asc', $Limit = false, $PageNumber = false )

getAllDefaultRoles() 공개 정적인 메소드

Get the default role IDs for all types of roles.
public static getAllDefaultRoles ( ) : array
리턴 array Returns an array of arrays indexed by role type.

getApplicantCount() 공개 메소드

Get the current number of applicants waiting to be approved.
public getApplicantCount ( boolean $Force = false ) : integer
$Force boolean Whether or not to force a cache refresh.
리턴 integer Returns the number of applicants or 0 if the registration method isn't set to approval.

getArray() 공개 메소드

Returns an array of RoleID => RoleName pairs.
public getArray ( ) : array
리턴 array

getAssignable() 공개 메소드

Get the roles that the current user is allowed to assign to another user.
public getAssignable ( ) : array
리턴 array Returns an array in the format `[RoleID => 'Role Name']`.

getByName() 공개 정적인 메소드

Get a role by name.
public static getByName ( array | string $Names, &$Missing = null )
$Names array | string

getByNotRoleID() 공개 메소드

Returns a resultset of role data NOT related to the specified RoleID.
public getByNotRoleID ( $RoleID )

getByPermission() 공개 메소드

Retrieves all roles with the specified permission(s).
public getByPermission ( $Permission )

getByRoleID() 공개 메소드

Returns a resultset of role data related to the specified RoleID.
public getByRoleID ( $RoleID )

getByType() 공개 메소드

Return all roles matching a specific type.
public getByType ( string $type ) : Gdn_DataSet
$type string Type slug to match role records against.
리턴 Gdn_DataSet

getByUserID() 공개 메소드

Get the roles for a user.
또한 보기: UserModel::getRoles()
public getByUserID ( integer $userID ) : Gdn_DataSet
$userID integer The user to get the roles for.
리턴 Gdn_DataSet Returns the roles as a dataset (with array values).

getCategoryPermissions() 공개 메소드

Get the category specific permissions for a role.
public getCategoryPermissions ( integer $roleID ) : array
$roleID integer The ID of the role to get the permissions for.
리턴 array Returns an array of permissions.

getDefaultRoles() 공개 정적인 메소드

Get the default role IDs for a type of role.
public static getDefaultRoles ( string $type ) : array
$type string One of the {@link RoleModel::TYPE_*} constants.
리턴 array Returns an array of role IDs.

getDefaultTypes() 공개 정적인 메소드

Get an array of default role types.
public static getDefaultTypes ( boolean $translate = true ) : array
$translate boolean Whether or not to translate the type names.
리턴 array Returns an array in the form `[type => name]`.

getPermissions() 공개 메소드

Get the permissions for one or more roles.
public getPermissions ( integer | array $RoleID ) : array
$RoleID integer | array One or more role IDs to get the permissions for.
리턴 array Returns an array of permissions.

getPublicUserRoles() 공개 메소드

Optionally return all the role data or just one field name.
public getPublicUserRoles ( $userID, string $field = "Name" ) : array | null | void
$userID
$field string optionally the field name from the role table to return.
리턴 array | null | void

getUserCount() 공개 메소드

Returns the number of users assigned to the provided RoleID. If $UsersOnlyWithThisRole is TRUE, it will return the number of users who are assigned to this RoleID and NO OTHER.
public getUserCount ( $RoleID, $UsersOnlyWithThisRole = false )

getWithRankPermissions() 공개 메소드

Get all of the roles including their ranking permissions.
public getWithRankPermissions ( ) : Gdn_DataSet
리턴 Gdn_DataSet Returns all of the roles with the ranking permissions.

roles() 공개 정적인 메소드

public static roles ( null $RoleID = null, boolean $Force = false ) : array | mixed | null | type
$RoleID null
$Force boolean
리턴 array | mixed | null | type

save() 공개 메소드

Save role data.
public save ( array $FormPostValues, array | false $Settings = false ) : boolean | mixed
$FormPostValues array The role row to save.
$Settings array | false Not used.
리턴 boolean | mixed Returns the role ID or false on error.

setUserRoles() 공개 정적인 메소드

public static setUserRoles ( &$Users, string $UserIDColumn = 'UserID', string $RolesColumn = 'Roles' )
$Users
$UserIDColumn string
$RolesColumn string

프로퍼티 상세

$RankPermissions 공개적으로 프로퍼티

A list of permissions that define an increasing ranking of permissions.
public $RankPermissions

$Roles 공개적으로 정적으로 프로퍼티

All roles.
public static $Roles