diff options
| author | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-30 05:03:23 +0300 |
|---|---|---|
| committer | George Halkiadakis <gchalkiadakis@sklavenitis.co.gr> | 2023-03-30 05:03:23 +0300 |
| commit | 4f2d900af7636e6744ae14aeeefdf2d6080ac50a (patch) | |
| tree | 1f80775437510591656e6ef13375516226ed27f3 /html/app/extends/Classroom_user.php | |
| parent | a16d070c4f8301a8b68220aca6d3573705be9025 (diff) | |
| download | classroom-4f2d900af7636e6744ae14aeeefdf2d6080ac50a.tar.gz classroom-4f2d900af7636e6744ae14aeeefdf2d6080ac50a.tar.bz2 classroom-4f2d900af7636e6744ae14aeeefdf2d6080ac50a.zip | |
several mail options tested; mailhog (fake) mailer is working
Diffstat (limited to 'html/app/extends/Classroom_user.php')
| -rw-r--r-- | html/app/extends/Classroom_user.php | 105 |
1 files changed, 25 insertions, 80 deletions
diff --git a/html/app/extends/Classroom_user.php b/html/app/extends/Classroom_user.php index b451114..fd1e573 100644 --- a/html/app/extends/Classroom_user.php +++ b/html/app/extends/Classroom_user.php @@ -1,107 +1,52 @@ <?php -namespace app\controllers; +namespace app\extends; -use UserManager; +use User; use Registry; -use app\models\admin\User_model; - -/** ClassUserManager +/** Classroom_user * - * extends (anom's) UserManager + * extends (anom's) User * * this way it specializes the UserManagement * according to this app's special rules * + * Add privileges concept + * --- + * A Class_user has privileges (which are deferent than Roles) + * In fact, privileges extend the authorization requirements for users + * + * Authorized content is marked with some 'minimum Privilege' + * So the content is available to the READER(s) that have certain Privileges + * */ -class Classroom_user extends UserManager +class Classroom_user extends User { - private $index_key = 'email'; // identifing user field (username, email, etc ) - - protected $user; - - public function __construct() - { - parent::__construct(); - } + // @var array + private $privileges = []; - /** register user - * - * register into database; - * send OTP for account confirmation - * - * @param (void) : user properties passed via REQUEST->POST + /** getPrivileges * + * @return privileges (array) */ - public function register_user() + public function getPrivileges(): array { - $req = Registry::get('REQUEST'); - $register = User_model::registerUser($req->POST); - - if ($register['success']) { - - //create OTP; - $otp = $this->create_OPT($register['id']); - - // send for account confirmation - - - } else { - print_r($register); - } - + return $this->privileges; } - - public function login_user() - { - - } - - - /** forgot password + /** setPrivileges() * - * send an otp - * (then verify) + * @param array $privileges * + * @return User */ - public function forgot_password() + public function setPrivileges(array $privileges): self { - - } - - - /** create OTP - * - * create a random OTP - * keep it into User's database Table - * - * @param $id (int): user id - * - */ - public function create_OTP($id) - { - $otp = rand(100000,999999); - User_model::set_OTP($id, $otp); - - return true; - } - - - /** Verify Account - * - * check if posted OTP matched the one sent to the user - * - * @param $identity (array): pair of [index_key => identity_value] - * example: [ 'email' => 'geo@roptron.gr' ] - * - */ - public function verify_otp($identity, $otp) - { - + $this->privileges = $privileges; + return $this; } |
