* @package generis */ abstract class common_user_User implements User, Refreshable { /** * Store roles to prevent recalculation in runtime * @var array */ protected $roles = []; abstract public function getIdentifier(); abstract public function getPropertyValues($property); abstract public function refresh(); /** * Extends the users explizit roles with the implizit rules * of the local system * * @return array the identifiers of the roles: */ public function getRoles() { $returnValue = []; if (! $this->roles) { // We use a Depth First Search approach to flatten the Roles Graph. foreach ($this->getPropertyValues(GenerisRdf::PROPERTY_USER_ROLES) as $roleUri) { $returnValue[] = $roleUri; foreach (core_kernel_users_Service::singleton()->getIncludedRoles(new core_kernel_classes_Resource($roleUri)) as $role) { $returnValue[] = $role->getUri(); } } $returnValue = array_unique($returnValue); $this->roles = $returnValue; } return $this->roles; } }