diff --git a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/README.md b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/README.md index 109f6b4..a1c29a4 100644 --- a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/README.md +++ b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/README.md @@ -18,6 +18,7 @@ class Linker << (F,LightGreen) >> #Green { + __construct(Load $load, Insert $insert, ...) + get() : ?string + active(bool $setup = true) : ?string + + valid(string $linker) : bool + set(string $linker) : bool + access(string $linker, string $pass, ...) : ?array - hasAccess(string $linker, string $pass) : bool @@ -53,14 +54,21 @@ note right of Linker::active return: ?string end note -note left of Linker::set +note left of Linker::valid + Check if a Linker is valid active linker + + since: 2.0.1 + return: bool +end note + +note right of Linker::set Set Active Linker since: 2.0.1 return: bool end note -note right of Linker::access +note left of Linker::access Set Access since: 2.0.1 @@ -72,35 +80,35 @@ note right of Linker::access ?string $oldPass end note -note left of Linker::hasAccess +note right of Linker::hasAccess Has Access since: 2.0.1 return: bool end note -note right of Linker::getPassGuid +note left of Linker::getPassGuid Get Password GUID since: 2.0.1 return: ?string end note -note left of Linker::getPassword +note right of Linker::getPassword Get Password since: 2.0.1 return: ?object end note -note right of Linker::setLinker +note left of Linker::setLinker Set Linker since: 2.0.1 return: bool end note -note left of Linker::setPassword +note right of Linker::setPassword Set Password since: 2.0.1 diff --git a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php index 9ef23ac..28d6142 100644 --- a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php +++ b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.php @@ -130,6 +130,28 @@ final class Linker return null; } + /** + * Check if a Linker is valid active linker + * + * @param string $linker The linker GUID value + * + * @return bool True if active valid linker + * @since 2.0.1 + **/ + public function valid(string $linker): bool + { + // is only valid if this linker has an active password + if (GuidHelper::valid($linker) && ($password_name = $this->load->value( + ['linker' => $linker, 'published' => 1], + 'name', 'password' + )) !== null) + { + return true; + } + + return false; + } + /** * Set Active Linker * @@ -144,7 +166,7 @@ final class Linker { return false; } - + $this->session->set('getbible_active_linker_guid', $linker); return true; diff --git a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power index f2f207d..8ec4271 100644 --- a/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power +++ b/src/36ab759f-7b42-4465-9c17-56ba1dd05f90/code.power @@ -100,6 +100,28 @@ return null; } + /** + * Check if a Linker is valid active linker + * + * @param string $linker The linker GUID value + * + * @return bool True if active valid linker + * @since 2.0.1 + **/ + public function valid(string $linker): bool + { + // is only valid if this linker has an active password + if (GuidHelper::valid($linker) && ($password_name = $this->load->value( + ['linker' => $linker, 'published' => 1], + 'name', 'password' + )) !== null) + { + return true; + } + + return false; + } + /** * Set Active Linker * @@ -114,7 +136,7 @@ { return false; } - + $this->session->set('getbible_active_linker_guid', $linker); return true;