PHP 인터페이스 yii\rbac\ManagerInterface

부터: 2.0
저자: Qiang Xue ([email protected])
파일 보기 프로젝트 열기: yiisoft/yii2 0 사용 예제들

공개 메소드들

메소드 설명
add ( Role | Permission | Rule $object ) : boolean Adds a role, permission or rule to the RBAC system.
addChild ( Item $parent, Item $child ) : boolean Adds an item as a child of another item.
assign ( Role $role, string | integer $userId ) : Assignment Assigns a role to a user.
canAddChild ( Item $parent, Item $child ) : boolean Checks the possibility of adding a child to parent
createPermission ( string $name ) : Permission Creates a new Permission object.
createRole ( string $name ) : Role Creates a new Role object.
getAssignment ( string $roleName, string | integer $userId ) : null | Assignment Returns the assignment information regarding a role and a user.
getAssignments ( string | integer $userId ) : Assignment[] Returns all role assignment information for the specified user.
getChildRoles ( string $roleName ) : Role[] Returns child roles of the role specified. Depth isn't limited.
getChildren ( string $name ) : Item[] Returns the child permissions and/or roles.
getPermission ( string $name ) : null | Permission Returns the named permission.
getPermissions ( ) : Permission[] Returns all permissions in the system.
getPermissionsByRole ( string $roleName ) : Permission[] Returns all permissions that the specified role represents.
getPermissionsByUser ( string | integer $userId ) : Permission[] Returns all permissions that the user has.
getRole ( string $name ) : null | Role Returns the named role.
getRoles ( ) : Role[] Returns all roles in the system.
getRolesByUser ( string | integer $userId ) : Role[] Returns the roles that are assigned to the user via ManagerInterface::assign.
getRule ( string $name ) : null | Rule Returns the rule of the specified name.
getRules ( ) : Rule[] Returns all rules available in the system.
getUserIdsByRole ( string $roleName ) : array Returns all user IDs assigned to the role specified.
hasChild ( Item $parent, Item $child ) : boolean Returns a value indicating whether the child already exists for the parent.
remove ( Role | Permission | Rule $object ) : boolean Removes a role, permission or rule from the RBAC system.
removeAll ( ) Removes all authorization data, including roles, permissions, rules, and assignments.
removeAllAssignments ( ) Removes all role assignments.
removeAllPermissions ( ) Removes all permissions.
removeAllRoles ( ) Removes all roles.
removeAllRules ( ) Removes all rules.
removeChild ( Item $parent, Item $child ) : boolean Removes a child from its parent.
removeChildren ( Item $parent ) : boolean Removed all children form their parent.
revoke ( Role $role, string | integer $userId ) : boolean Revokes a role from a user.
revokeAll ( mixed $userId ) : boolean Revokes all roles from a user.
update ( string $name, Role | Permission | Rule $object ) : boolean Updates the specified role, permission or rule in the system.

메소드 상세

add() 공개 메소드

Adds a role, permission or rule to the RBAC system.
public add ( Role | Permission | Rule $object ) : boolean
$object Role | Permission | Rule
리턴 boolean whether the role, permission or rule is successfully added to the system

addChild() 공개 메소드

Adds an item as a child of another item.
public addChild ( Item $parent, Item $child ) : boolean
$parent Item
$child Item
리턴 boolean whether the child successfully added

assign() 공개 메소드

Assigns a role to a user.
public assign ( Role $role, string | integer $userId ) : Assignment
$role Role
$userId string | integer the user ID (see [[\yii\web\User::id]])
리턴 Assignment the role assignment information.

canAddChild() 공개 메소드

Checks the possibility of adding a child to parent
부터: 2.0.8
public canAddChild ( Item $parent, Item $child ) : boolean
$parent Item the parent item
$child Item the child item to be added to the hierarchy
리턴 boolean possibility of adding

createPermission() 공개 메소드

Note that the newly created permission is not added to the RBAC system yet. You must fill in the needed data and call ManagerInterface::add to add it to the system.
public createPermission ( string $name ) : Permission
$name string the permission name
리턴 Permission the new Permission object

createRole() 공개 메소드

Note that the newly created role is not added to the RBAC system yet. You must fill in the needed data and call ManagerInterface::add to add it to the system.
public createRole ( string $name ) : Role
$name string the role name
리턴 Role the new Role object

getAssignment() 공개 메소드

Returns the assignment information regarding a role and a user.
public getAssignment ( string $roleName, string | integer $userId ) : null | Assignment
$roleName string the role name
$userId string | integer the user ID (see [[\yii\web\User::id]])
리턴 null | Assignment the assignment information. Null is returned if the role is not assigned to the user.

getAssignments() 공개 메소드

Returns all role assignment information for the specified user.
public getAssignments ( string | integer $userId ) : Assignment[]
$userId string | integer the user ID (see [[\yii\web\User::id]])
리턴 Assignment[] the assignments indexed by role names. An empty array will be returned if there is no role assigned to the user.

getChildRoles() 공개 메소드

Returns child roles of the role specified. Depth isn't limited.
부터: 2.0.10
public getChildRoles ( string $roleName ) : Role[]
$roleName string name of the role to file child roles for
리턴 Role[] Child roles. The array is indexed by the role names. First element is an instance of the parent Role itself.

getChildren() 공개 메소드

Returns the child permissions and/or roles.
public getChildren ( string $name ) : Item[]
$name string the parent name
리턴 Item[] the child permissions and/or roles

getPermission() 공개 메소드

Returns the named permission.
public getPermission ( string $name ) : null | Permission
$name string the permission name.
리턴 null | Permission the permission corresponding to the specified name. Null is returned if no such permission.

getPermissions() 공개 메소드

Returns all permissions in the system.
public getPermissions ( ) : Permission[]
리턴 Permission[] all permissions in the system. The array is indexed by the permission names.

getPermissionsByRole() 공개 메소드

Returns all permissions that the specified role represents.
public getPermissionsByRole ( string $roleName ) : Permission[]
$roleName string the role name
리턴 Permission[] all permissions that the role represents. The array is indexed by the permission names.

getPermissionsByUser() 공개 메소드

Returns all permissions that the user has.
public getPermissionsByUser ( string | integer $userId ) : Permission[]
$userId string | integer the user ID (see [[\yii\web\User::id]])
리턴 Permission[] all permissions that the user has. The array is indexed by the permission names.

getRole() 공개 메소드

Returns the named role.
public getRole ( string $name ) : null | Role
$name string the role name.
리턴 null | Role the role corresponding to the specified name. Null is returned if no such role.

getRoles() 공개 메소드

Returns all roles in the system.
public getRoles ( ) : Role[]
리턴 Role[] all roles in the system. The array is indexed by the role names.

getRolesByUser() 공개 메소드

Note that child roles that are not assigned directly to the user will not be returned.
public getRolesByUser ( string | integer $userId ) : Role[]
$userId string | integer the user ID (see [[\yii\web\User::id]])
리턴 Role[] all roles directly assigned to the user. The array is indexed by the role names.

getRule() 공개 메소드

Returns the rule of the specified name.
public getRule ( string $name ) : null | Rule
$name string the rule name
리턴 null | Rule the rule object, or null if the specified name does not correspond to a rule.

getRules() 공개 메소드

Returns all rules available in the system.
public getRules ( ) : Rule[]
리턴 Rule[] the rules indexed by the rule names

getUserIdsByRole() 공개 메소드

Returns all user IDs assigned to the role specified.
부터: 2.0.7
public getUserIdsByRole ( string $roleName ) : array
$roleName string
리턴 array array of user ID strings

hasChild() 공개 메소드

Returns a value indicating whether the child already exists for the parent.
public hasChild ( Item $parent, Item $child ) : boolean
$parent Item
$child Item
리턴 boolean whether `$child` is already a child of `$parent`

remove() 공개 메소드

Removes a role, permission or rule from the RBAC system.
public remove ( Role | Permission | Rule $object ) : boolean
$object Role | Permission | Rule
리턴 boolean whether the role, permission or rule is successfully removed

removeAll() 공개 메소드

Removes all authorization data, including roles, permissions, rules, and assignments.
public removeAll ( )

removeAllAssignments() 공개 메소드

Removes all role assignments.

removeAllPermissions() 공개 메소드

All parent child relations will be adjusted accordingly.

removeAllRoles() 공개 메소드

All parent child relations will be adjusted accordingly.
public removeAllRoles ( )

removeAllRules() 공개 메소드

All roles and permissions which have rules will be adjusted accordingly.
public removeAllRules ( )

removeChild() 공개 메소드

Note, the child item is not deleted. Only the parent-child relationship is removed.
public removeChild ( Item $parent, Item $child ) : boolean
$parent Item
$child Item
리턴 boolean whether the removal is successful

removeChildren() 공개 메소드

Note, the children items are not deleted. Only the parent-child relationships are removed.
public removeChildren ( Item $parent ) : boolean
$parent Item
리턴 boolean whether the removal is successful

revoke() 공개 메소드

Revokes a role from a user.
public revoke ( Role $role, string | integer $userId ) : boolean
$role Role
$userId string | integer the user ID (see [[\yii\web\User::id]])
리턴 boolean whether the revoking is successful

revokeAll() 공개 메소드

Revokes all roles from a user.
public revokeAll ( mixed $userId ) : boolean
$userId mixed the user ID (see [[\yii\web\User::id]])
리턴 boolean whether the revoking is successful

update() 공개 메소드

Updates the specified role, permission or rule in the system.
public update ( string $name, Role | Permission | Rule $object ) : boolean
$name string the old name of the role, permission or rule
$object Role | Permission | Rule
리턴 boolean whether the update is successful