ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\Authentication\KeyValueStorage\UiStorageAdapter Class Reference

Adapts key-value storage to the UI ArrayAccess contract. More...

+ Inheritance diagram for ILIAS\Authentication\KeyValueStorage\UiStorageAdapter:
+ Collaboration diagram for ILIAS\Authentication\KeyValueStorage\UiStorageAdapter:

Public Member Functions

 __construct (private AuthenticatedSubjectResolver $subjects, private Services $services, Refinery $refinery,)
 
 offsetExists (mixed $offset)
 
 offsetGet (mixed $offset)
 
 offsetSet (mixed $offset, mixed $value)
 
 offsetUnset (mixed $offset)
 

Private Member Functions

 storage ()
 Chosen per access, since the user may log in or out after the adapter was built. More...
 
 assertStringOffset (mixed $offset)
 

Private Attributes

const array NAMESPACE = ['ui', 'storage']
 
Transformation $as_stored
 

Detailed Description

Adapts key-value storage to the UI ArrayAccess contract.

A fully authenticated user keeps UI state in the persistent subject store. Everyone else keeps it in the current session.

Definition at line 36 of file UiStorageAdapter.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::__construct ( private AuthenticatedSubjectResolver  $subjects,
private Services  $services,
Refinery  $refinery 
)

Definition at line 42 of file UiStorageAdapter.php.

46 {
47 $this->as_stored = $refinery->identity();
48 }

References ILIAS\UI\examples\Layout\Page\Mail\$refinery.

Member Function Documentation

◆ assertStringOffset()

ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::assertStringOffset ( mixed  $offset)
private

Definition at line 81 of file UiStorageAdapter.php.

81 : string
82 {
83 if (!\is_string($offset)) {
84 throw new \InvalidArgumentException('Offset needs to be of type string.');
85 }
86
87 return $offset;
88 }

Referenced by ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetExists(), ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetGet(), ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetSet(), and ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetUnset().

+ Here is the caller graph for this function:

◆ offsetExists()

ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::offsetExists ( mixed  $offset)

Definition at line 61 of file UiStorageAdapter.php.

61 : bool
62 {
63 return $this->storage()->has($this->assertStringOffset($offset));
64 }
storage()
Chosen per access, since the user may log in or out after the adapter was built.

References ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\assertStringOffset(), and ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\storage().

+ Here is the call graph for this function:

◆ offsetGet()

ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::offsetGet ( mixed  $offset)

Definition at line 66 of file UiStorageAdapter.php.

66 : mixed
67 {
68 return $this->storage()->get($this->assertStringOffset($offset), $this->as_stored);
69 }

References ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\assertStringOffset(), and ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\storage().

Referenced by ILIAS\Tests\Authentication\KeyValueStorage\UiStorageAdapterTest\testOffsetGetPassesTheIdentityTransformation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetSet()

ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::offsetSet ( mixed  $offset,
mixed  $value 
)

Definition at line 71 of file UiStorageAdapter.php.

71 : void
72 {
73 $this->storage()->set($this->assertStringOffset($offset), $value);
74 }

References ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\assertStringOffset(), and ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\storage().

Referenced by ILIAS\Tests\Authentication\KeyValueStorage\UiStorageAdapterTest\testALoginAfterTheAdapterWasBuiltSwitchesToThePersistentStore().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ offsetUnset()

ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::offsetUnset ( mixed  $offset)

Definition at line 76 of file UiStorageAdapter.php.

76 : void
77 {
78 $this->storage()->delete($this->assertStringOffset($offset));
79 }

References ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\assertStringOffset(), and ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\storage().

+ Here is the call graph for this function:

◆ storage()

ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::storage ( )
private

Chosen per access, since the user may log in or out after the adapter was built.

The stores are memoized by the storage services.

Definition at line 54 of file UiStorageAdapter.php.

54 : Store
55 {
56 return $this->subjects->supportsPersistentStorage()
57 ? $this->services->persistentFor($this->subjects, self::NAMESPACE)
58 : $this->services->session(self::NAMESPACE);
59 }

Referenced by ILIAS\UI\Implementation\Component\Table\AbstractTable\getStorageData(), ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetExists(), ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetGet(), ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetSet(), ILIAS\Authentication\KeyValueStorage\UiStorageAdapter\offsetUnset(), and ILIAS\UI\Implementation\Component\Table\AbstractTable\setStorageData().

+ Here is the caller graph for this function:

Field Documentation

◆ $as_stored

Transformation ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::$as_stored
private

Definition at line 40 of file UiStorageAdapter.php.

◆ NAMESPACE

const array ILIAS\Authentication\KeyValueStorage\UiStorageAdapter::NAMESPACE = ['ui', 'storage']
private

Definition at line 38 of file UiStorageAdapter.php.


The documentation for this class was generated from the following file: