Auth Functions
current_user_can()
/**
* Checks if current user has specified permission or not.
*
* @file App/Shared/Helpers/auth.php
* @param string $perm Permission to check for.
* @param array $ruleParams
* @return bool Return true if permission matches or false otherwise.
* @throws CommandPropertyNotFoundException
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws TypeException
* @throws UnresolvableQueryHandlerExceptionAlias
*/
function current_user_can(string $perm, array $ruleParams = []): bool;
is_user_logged_in()
/**
* Checks if a visitor is logged in or not.
*
* @file App/Shared/Helpers/auth.php
* @return bool
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function is_user_logged_in(): bool;
cms_authenticate()
/**
* Logs a user in after the login information has checked out.
*
* @file App/Shared/Helpers/auth.php
* @param string $login User's username or email address.
* @param string $password User's password.
* @param string $rememberme Whether to remember the user.
* @return ResponseInterface
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws SessionException
*/
function cms_authenticate(string $login, string $password, string $rememberme): ResponseInterface;
cms_authenticate_user()
/**
* Checks a user's login information.
*
* @file App/Shared/Helpers/auth.php
* @param string $login User's username or email address.
* @param string $password User's password.
* @param string $rememberme Whether to remember the user.
* @return string|ResponseInterface Returns credentials if valid, null or false otherwise.
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
* @throws SessionException
*/
function cms_authenticate_user(string $login, string $password, string $rememberme): string|ResponseInterface;
cms_set_auth_cookie()
/**
* Sets auth cookie.
*
* @file App/Shared/Helpers/auth.php
* @param array $user User data array.
* @param string $rememberme Should user be remembered for a length of time?
* @throws ContainerExceptionInterface
* @throws Exception
* @throws InvalidArgumentException
* @throws NotFoundExceptionInterface
* @throws ReflectionException
*/
function cms_set_auth_cookie(array $user, string $rememberme = ''): void;
cms_clear_auth_cookie()
/**
* Removes all cookies associated with authentication.
*
* @file App/Shared/Helpers/auth.php
* @throws ReflectionException
* @throws Exception
*/
function cms_clear_auth_cookie(): void;
get_secure_cookie_data()
/**
* Retrieves data from a secure cookie.
*
* @file App/Shared/Helpers/auth.php
* @param string $key COOKIE key.
* @return false|array|object Cookie data or false.
*/
function get_secure_cookie_data(string $key): false|array|object;