Documentation

UserGroupManager extends StaticFactory

User Extended by Shawn Clake Class UserGroupManager User Extended is licensed under the MIT license.

Tags
author

Shawn Clake shawn.clake@gmail.com

link
https://github.com/ShawnClake/UserExtended
license

https://github.com/ShawnClake/UserExtended/blob/master/LICENSE MIT

Handles all interactions with groups on a user level

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
$name :
$arguments :
Return values
mixed

addGroup()

Add a group to a user

public addGroup( $groupCode) : bool
Parameters
$groupCode :
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

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
$group :
$groups : = null
Return values
bool

removeGroup()

Remove a group from a user

public removeGroup( $groupCode) : bool
Parameters
$groupCode :
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
Return values
$this

Search results