UserAspect implements AspectInterface

The aspect contains information about a user.

Can be used for frontend and backend users.

Allowed properties:

  • id
  • username
  • isLoggedIn
  • groupIds (Array of Ids)
  • groupNames

Table of Contents

Interfaces

AspectInterface
Interface AspectInterface Think of an aspect like a property bag

Properties

$groups  : array<string|int, int>|null
Alternative list of groups, usually useful for frontend logins with "magic" groups like "-1" and "-2"
$user  : AbstractUserAuthentication|stdClass

Methods

__construct()  : mixed
get()  : int|bool|string|array<string|int, mixed>
Fetch common information about the user
getGroupIds()  : array<string|int, mixed>
Return the groups the user is a member of
getGroupNames()  : array<string|int, mixed>
Get the name of all groups, used in Fluid's IfHasRole ViewHelper
isAdmin()  : bool
Check if admin is set
isLoggedIn()  : bool
A user is logged in if the user has a UID, but does not care about groups.
isUserOrGroupSet()  : bool
Checking if a user is logged in or a group constellation different from "0,-1"

Properties

$groups

Alternative list of groups, usually useful for frontend logins with "magic" groups like "-1" and "-2"

protected array<string|int, int>|null $groups

Methods

get()

Fetch common information about the user

public get(string $name) : int|bool|string|array<string|int, mixed>
Parameters
$name : string
Tags
throws
AspectPropertyNotFoundException
Return values
int|bool|string|array<string|int, mixed>

getGroupIds()

Return the groups the user is a member of

public getGroupIds() : array<string|int, mixed>

For Frontend Users there are two special groups: "-1" = hide at login "-2" = show at any login

Return values
array<string|int, mixed>

getGroupNames()

Get the name of all groups, used in Fluid's IfHasRole ViewHelper

public getGroupNames() : array<string|int, mixed>
Return values
array<string|int, mixed>

isAdmin()

Check if admin is set

public isAdmin() : bool
Return values
bool

isLoggedIn()

A user is logged in if the user has a UID, but does not care about groups.

public isLoggedIn() : bool

For frontend purposes, it is possible to e.g. simulate groups, but this would still be defined as "not logged in".

For backend, only the check on the user ID is used.

Return values
bool

isUserOrGroupSet()

Checking if a user is logged in or a group constellation different from "0,-1"

public isUserOrGroupSet() : bool
Return values
bool

TRUE if either a login user is found OR if the group list is set to something else than '0,-1' (could be done even without a user being logged in!)


        
On this page

Search results