UserGroupManager
extends StaticFactory
in package
User Extended by Shawn Clake Class UserGroupManager User Extended is licensed under the MIT license.
Tags
Table of Contents
- $user : mixed
- Stores the user object for the member of the groups we are getting
- $userGroups : mixed
- Stores an array of UserGroups. ["GroupName" => "GroupDescriptionObject"]
- __callStatic() : mixed
- Main factory function which utilizes PHP's magic method to call a suffixed factory function on the child class.
- addGroup() : bool
- Add a group to a user
- allGroups() : $this
- Finds all the groups the user is in and stores that to the class IE $userGroups TODO: Can we not just use the 'groups' relation provided on RainLab.Users User model
- currentUser() :
- currentUserFactory() : UserGroupManager|null
- Sets the class up to use the currently logged in user
- factory() : mixed
- Helper function which can also be used to simply create an instance of a child class in cases where initialization functions aren't needed.
- getUsersGroups() : mixed
- Returns a collection of groups a user is in
- isInGroup() : bool
- Returns whether or not the user is a part of a group
- removeGroup() : bool
- Remove a group from a user
- with() :
- withFactory() : $this
- Pass a user object to get groups for that user
Properties
$user
Stores the user object for the member of the groups we are getting
private
mixed
$user
$userGroups
Stores an array of UserGroups. ["GroupName" => "GroupDescriptionObject"]
private
mixed
$userGroups
Methods
__callStatic()
Main factory function which utilizes PHP's magic method to call a suffixed factory function on the child class.
public
static __callStatic( $name, $arguments) : mixed
Parameters
Return values
mixed —addGroup()
Add a group to a user
public
addGroup( $groupCode) : bool
Parameters
Return values
bool —allGroups()
Finds all the groups the user is in and stores that to the class IE $userGroups TODO: Can we not just use the 'groups' relation provided on RainLab.Users User model
public
allGroups() : $this
Return values
$this —currentUser()
public
static currentUser() :
UserGroupManager
Return values
—currentUserFactory()
Sets the class up to use the currently logged in user
public
currentUserFactory() : UserGroupManager|null
Return values
UserGroupManager|null —factory()
Helper function which can also be used to simply create an instance of a child class in cases where initialization functions aren't needed.
public
static factory() : mixed
Generally you will want to use the static magic method below.
Return values
mixed —getUsersGroups()
Returns a collection of groups a user is in
public
getUsersGroups() : mixed
Return values
mixed —isInGroup()
Returns whether or not the user is a part of a group
public
isInGroup( $group[, $groups = null ]) : bool
Parameters
Return values
bool —removeGroup()
Remove a group from a user
public
removeGroup( $groupCode) : bool
Parameters
Return values
bool —with()
public
static with(mixed $user) :
UserGroupManager
Parameters
- $user : mixed
Return values
—withFactory()
Pass a user object to get groups for that user
public
withFactory([null $user = null ]) : $this
Parameters
- $user : null = null