4
0

update 2023-07-28 08:15:37

This commit is contained in:
Robot 2023-07-28 08:15:37 +02:00
parent aea21b5221
commit e4c2212070
Signed by: Robot
GPG Key ID: 14DECD44E7E1BB95
3 changed files with 83 additions and 5 deletions

View File

@ -26,6 +26,7 @@ class Linker << (F,LightGreen) >> #Green {
+ set(string $linker) : bool + set(string $linker) : bool
+ setName(string $name) : ?array + setName(string $name) : ?array
+ access(string $linker, string $pass, ...) : ?array + access(string $linker, string $pass, ...) : ?array
+ revoke(string $linker) : ?array
- hasAccess(string $linker, string $pass) : bool - hasAccess(string $linker, string $pass) : bool
- getPassGuid(string $linker, string $pass) : ?string - getPassGuid(string $linker, string $pass) : ?string
- getPassword(string $linker, string $pass) : ?object - getPassword(string $linker, string $pass) : ?object
@ -113,35 +114,42 @@ note left of Linker::access
?string $oldPass ?string $oldPass
end note end note
note right of Linker::hasAccess note right of Linker::revoke
Revoke Access
since: 2.0.1
return: ?array
end note
note left of Linker::hasAccess
Has Access Has Access
since: 2.0.1 since: 2.0.1
return: bool return: bool
end note end note
note left of Linker::getPassGuid note right of Linker::getPassGuid
Get Password GUID Get Password GUID
since: 2.0.1 since: 2.0.1
return: ?string return: ?string
end note end note
note right of Linker::getPassword note left of Linker::getPassword
Get Password Get Password
since: 2.0.1 since: 2.0.1
return: ?object return: ?object
end note end note
note left of Linker::setLinker note right of Linker::setLinker
Set Linker Set Linker
since: 2.0.1 since: 2.0.1
return: bool return: bool
end note end note
note right of Linker::setPassword note left of Linker::setPassword
Set Password Set Password
since: 2.0.1 since: 2.0.1

View File

@ -369,6 +369,41 @@ final class Linker
return (array) $_linker; return (array) $_linker;
} }
/**
* Revoke Access
*
* @param string $linker The linker GUID value
*
* @return array|null The success or error details
* @since 2.0.1
**/
public function revoke(string $linker): ?array
{
// linker not valid GUID
if (!GuidHelper::valid($linker))
{
// hmm we can log this
return [
'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED')
];
}
if (($access = $this->session->get("getbible_active_{$linker}", null)) === null
|| $access !== 'valid_access')
{
// hmm we can log this
return [
'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED')
];
}
$this->session->set("getbible_active_{$linker}", null);
return [
'success' => Text::_('COM_GETBIBLE_ACCESS_REVOKED')
];
}
/** /**
* Has Access * Has Access
* *

View File

@ -339,6 +339,41 @@
return (array) $_linker; return (array) $_linker;
} }
/**
* Revoke Access
*
* @param string $linker The linker GUID value
*
* @return array|null The success or error details
* @since 2.0.1
**/
public function revoke(string $linker): ?array
{
// linker not valid GUID
if (!GuidHelper::valid($linker))
{
// hmm we can log this
return [
'success' => Text::_('Access revoked.')
];
}
if (($access = $this->session->get("getbible_active_{$linker}", null)) === null
|| $access !== 'valid_access')
{
// hmm we can log this
return [
'success' => Text::_('Access revoked.')
];
}
$this->session->set("getbible_active_{$linker}", null);
return [
'success' => Text::_('Access revoked.')
];
}
/** /**
* Has Access * Has Access
* *