PHP Class BookStack\Repos\UserRepo

Show file Open project: ssddanbrown/bookstack

Protected Properties

Property Type Description
$entityRepo
$role
$user

Public Methods

Method Description
__construct ( User $user, Role $role, EntityRepo $entityRepo ) UserRepo constructor.
attachDefaultRole ( $user ) Give a user the default role. Used when creating a new user.
create ( array $data ) : User Create a new basic instance of user.
destroy ( User $user ) Remove the given user from storage, Delete all related content.
getActivity ( User $user, integer $count = 20, integer $page ) : array Get the latest activity for a user.
getAllRoles ( ) : mixed Get the roles in the system that are assignable to a user.
getAllUsers ( ) : Builder | static Get all the users with their permissions.
getAllUsersPaginatedAndSorted ( integer $count = 20, $sortData ) : Builder | static Get all the users with their permissions in a paginated format.
getAssetCounts ( User $user ) : array Get asset created counts for the give user.
getByEmail ( string $email ) : User | null
getById ( integer $id ) : User
getRecentlyCreated ( User $user, integer $count = 20 ) : mixed Get the recently created content for this given user.
getRestrictableRoles ( ) : mixed Get all the roles which can be given restricted access to other entities in the system.
isOnlyAdmin ( User $user ) : boolean Checks if the give user is the only admin.
registerNew ( array $data ) : User Creates a new user and attaches a role to them.

Method Details

__construct() public method

UserRepo constructor.
public __construct ( User $user, Role $role, EntityRepo $entityRepo )
$user BookStack\User
$role BookStack\Role
$entityRepo EntityRepo

attachDefaultRole() public method

Give a user the default role. Used when creating a new user.
public attachDefaultRole ( $user )
$user

create() public method

Create a new basic instance of user.
public create ( array $data ) : User
$data array
return BookStack\User

destroy() public method

Remove the given user from storage, Delete all related content.
public destroy ( User $user )
$user BookStack\User

getActivity() public method

Get the latest activity for a user.
public getActivity ( User $user, integer $count = 20, integer $page ) : array
$user BookStack\User
$count integer
$page integer
return array

getAllRoles() public method

Get the roles in the system that are assignable to a user.
public getAllRoles ( ) : mixed
return mixed

getAllUsers() public method

Get all the users with their permissions.
public getAllUsers ( ) : Builder | static
return Illuminate\Database\Eloquent\Builder | static

getAllUsersPaginatedAndSorted() public method

Get all the users with their permissions in a paginated format.
public getAllUsersPaginatedAndSorted ( integer $count = 20, $sortData ) : Builder | static
$count integer
$sortData
return Illuminate\Database\Eloquent\Builder | static

getAssetCounts() public method

Get asset created counts for the give user.
public getAssetCounts ( User $user ) : array
$user BookStack\User
return array

getByEmail() public method

public getByEmail ( string $email ) : User | null
$email string
return BookStack\User | null

getById() public method

public getById ( integer $id ) : User
$id integer
return BookStack\User

getRecentlyCreated() public method

Get the recently created content for this given user.
public getRecentlyCreated ( User $user, integer $count = 20 ) : mixed
$user BookStack\User
$count integer
return mixed

getRestrictableRoles() public method

Get all the roles which can be given restricted access to other entities in the system.
public getRestrictableRoles ( ) : mixed
return mixed

isOnlyAdmin() public method

Checks if the give user is the only admin.
public isOnlyAdmin ( User $user ) : boolean
$user BookStack\User
return boolean

registerNew() public method

Creates a new user and attaches a role to them.
public registerNew ( array $data ) : User
$data array
return BookStack\User

Property Details

$entityRepo protected property

protected $entityRepo

$role protected property

protected $role

$user protected property

protected $user