ApiOpenStudio PHPDoc

UserRoleMapper extends Mapper
in package

Class UserRoleMapper.

Mapper class for DB calls used for the user_role table.

Table of Contents

$db  : ADOConnection
DB connector.
$logger  : MonologWrapper
Logger object.
__construct()  : mixed
Mapper constructor.
delete()  : bool
Delete the user role.
findAll()  : array<string|int, mixed>
Find all user roles.
findByFilter()  : array<string|int, mixed>
Find user roles using filter.
findByUid()  : array<string|int, mixed>
Find all user roles for a user ID.
findByUidAccidRolename()  : array<string|int, mixed>
Find user roles for a user by accid and rolename.
findByUidAppidRolename()  : UserRole
Fetch a user role by uid, appid and rolename.
findByUidRolename()  : array<string|int, mixed>
Fetch user roles by UID and role name.
findByUidRolenames()  : array<string|int, mixed>
Fetch user roles by UID that have a role in the array of role names.
findByUrid()  : UserRole
Find a user role by urid.
findForUidWithFilter()  : array<string|int, mixed>
Find user roles using filter.
hasAccidRole()  : bool
Return whether a user has a specified role in an account.
hasAppidAccess()  : bool
Return whether a user has access to an application.
hasRole()  : bool
Return whether a user has a specified role.
save()  : bool
Save the user role.
fetchRow()  : mixed
Perform an SQL statement that expects a single row.
fetchRows()  : array<string|int, mixed>
Perform an SQL statement that expects multiple rows.
mapArray()  : UserRole
Map a DB row to a UserRole object.
saveDelete()  : bool
Perform a save or delete.

Properties

$db

DB connector.

protected ADOConnection $db

DB Instance.

Methods

__construct()

Mapper constructor.

public __construct(ADOConnection $dbLayer, MonologWrapper $logger) : mixed
Parameters
$dbLayer : ADOConnection

DB connection object.

$logger : MonologWrapper

Logger object.

Return values
mixed

delete()

Delete the user role.

public delete(UserRole $userRole) : bool
Parameters
$userRole : UserRole

UserRole object.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

findAll()

Find all user roles.

public findAll() : array<string|int, mixed>
Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of mapped UserRole objects.

findByFilter()

Find user roles using filter.

public findByFilter(array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$params : array<string|int, mixed>

Associative array of filter params.

Tags
throws
ApiException

Return an ApiException on DB error.

example

findByFilter([ 'col' => ['rid' => 1], 'order_by' => 'uid', 'direction' => 'asc' )

Return values
array<string|int, mixed>

User roles

findByUid()

Find all user roles for a user ID.

public findByUid(int $uid) : array<string|int, mixed>
Parameters
$uid : int

User ID.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of UserRole objects.

findByUidAccidRolename()

Find user roles for a user by accid and rolename.

public findByUidAccidRolename(int $uid, int $accid, string $roleName) : array<string|int, mixed>
Parameters
$uid : int
$accid : int
$roleName : string
Tags
throws
ApiException
Return values
array<string|int, mixed>

findByUidAppidRolename()

Fetch a user role by uid, appid and rolename.

public findByUidAppidRolename(int $uid, int $appid, string $rolename) : UserRole
Parameters
$uid : int

User ID.

$appid : int

Application ID.

$rolename : string

Rolename.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
UserRole

User role object.

findByUidRolename()

Fetch user roles by UID and role name.

public findByUidRolename(int $uid, string $rolename) : array<string|int, mixed>
Parameters
$uid : int

User ID.

$rolename : string

Role name.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of UserRole objects.

findByUidRolenames()

Fetch user roles by UID that have a role in the array of role names.

public findByUidRolenames(int $uid, array<string|int, mixed> $rolenames[, string|null $accid = null ][, string|null $appid = null ]) : array<string|int, mixed>

With potentially account/application validation.

Parameters
$uid : int

User ID.

$rolenames : array<string|int, mixed>

Role names.

$accid : string|null = null

account ID. If null, no account ID validation.

$appid : string|null = null

application ID. If null, no application ID validation.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of UserRole objects.

findForUidWithFilter()

Find user roles using filter.

public findForUidWithFilter(int $uid, array<string|int, mixed> $params) : array<string|int, mixed>
Parameters
$uid : int

User ID.

$params : array<string|int, mixed>

Associative array of filter params.

Tags
throws
ApiException

Return an ApiException on DB error.

example

findByFilter([ 'col' => ['rid' => 1], 'order_by' => 'uid', 'direction' => 'asc' )

Return values
array<string|int, mixed>

User roles

hasAccidRole()

Return whether a user has a specified role in an account.

public hasAccidRole(int $uid, int $accid, string $rolename) : bool
Parameters
$uid : int

User ID.

$accid : int

Account ID.

$rolename : string

Role name.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

hasAppidAccess()

Return whether a user has access to an application.

public hasAppidAccess(int $uid, int $appid) : bool
Parameters
$uid : int

User ID.

$appid : int

Application ID.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

hasRole()

Return whether a user has a specified role.

public hasRole(int $uid, string $rolename) : bool
Parameters
$uid : int

User ID.

$rolename : string

Role name.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success.

save()

Save the user role.

public save(UserRole $userRole) : bool
Parameters
$userRole : UserRole

UserRole object.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Result of the save.

fetchRow()

Perform an SQL statement that expects a single row.

protected fetchRow(string $sql, array<string|int, mixed> $bindParams) : mixed
Parameters
$sql : string

Query string.

$bindParams : array<string|int, mixed>

Array of bind params.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
mixed

Mapped row.

fetchRows()

Perform an SQL statement that expects multiple rows.

protected fetchRows(string $sql[, array<string|int, mixed> $bindParams = [] ][, array<string|int, mixed> $params = [] ]) : array<string|int, mixed>
Parameters
$sql : string

Query string.

$bindParams : array<string|int, mixed> = []

Array of bind params.

$params : array<string|int, mixed> = []

Parameters (optional). Example: [ 'filter' => [ 'keyword' => string, 'column' => string, ] 'order_by' => string, 'direction' => string "ASC"|"DESC", 'offset' => int, 'limit' => int, ] NOTE: * This will throw an exception if the sql already contains a WHERE clause and should be calculated separately in these cases. * ['filter']['keyword'] '%' characters in keyword not added to keyword automatically.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
array<string|int, mixed>

Array of mapped rows.

mapArray()

Map a DB row to a UserRole object.

protected mapArray(array<string|int, mixed> $row) : UserRole
Parameters
$row : array<string|int, mixed>

DB Row.

Return values
UserRole

UserRole object.

saveDelete()

Perform a save or delete.

protected saveDelete(string $sql, array<string|int, mixed> $bindParams) : bool
Parameters
$sql : string

Query string.

$bindParams : array<string|int, mixed>

Array of bind params.

Tags
throws
ApiException

Return an ApiException on DB error.

Return values
bool

Success status.

Search results