joomla - Assign role to a user in Phalcon -


i'm new phalcon , used learn invo example application. in security.php found :

$auth = $this->session->get('auth');         if (!$auth){             $role = 'guests';         } else {             $role = 'users';         } 

are there way create user group different assigned role joomla? thanks

what can is, when user logs in set session follows :-

$this->session->set('auth', array(     'username' => $user->username,     'power' => $user->power //assuming have power assigned each user )); 

now when need check user's role can implement following method :-

$auth = $this->session->get('auth'); if(!$auth) {     $role = 'guest'; } elseif($auth['power'] == 0) {     $role = 'admin'; } elseif($auth['power'] == 2) {     $role = 'sub-admin'; } else {     $role = 'user'; //if power equals 1 or 2 assign role else assign normal user role } 

i hope helps.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -