21310 Posts in 5739 Topics by 2604 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 885 Views |
-
Detecting Default Admin

20 September 2010 at 9:48pm
Hi,
I can detect the user with Member::currentUser(), I wonder is there a way of detecting if the user that is returned is actually logged in or if it is the default admin that has been set in the _config (Security::setDefaultAdmin('Admin', 'Admin')) instead?
Barry
-
Re: Detecting Default Admin

22 September 2010 at 5:06pm
Admins are usualy in their own group. You can check that with inGroup() of the class Member.
-
Re: Detecting Default Admin

22 September 2010 at 6:32pm
Or use Permission::check('ADMIN'); to check for any admin rights on the current member.
-
Re: Detecting Default Admin

22 September 2010 at 8:18pm
Hi guys,
thanks for the answers although they have both slightly missed the mark... I'll explain a little more... if I have the following in _config.php...
Security::setDefaultAdmin('Admin', 'Admin');
and within "Security -> Security Groups -> Administrators" the user...
Swaiba - Swaiba - swaiba@swaiba.com - Swaiba
Either way if I login with Admin / Admin or Swaiba / Swaiba I will return true to being an administrator and the member DataObject returned will be the same.
What I am asking is can I tell that one user logged in the with the user/pass from the secrutiy system (Swaiba / Swaiba) or whether they have logged in using the default admin stuff (Admin / Admin)
Barry
-
Re: Detecting Default Admin

22 September 2010 at 8:40pm
I´m not the most experienced SS developer, but afaik the default admin is a admin like any other admin. With a dev/build the default admin gets his entry in the databases member table. Like this you can´t tell the default admin directly from an admin registered via the backend. There is one little differnce: A default admin has no Surname/Name. Maybe you can validate if those attributes are set or not.
Cheers -
Re: Detecting Default Admin

22 September 2010 at 10:28pm
No worries, I'd prefer not to rely on the name being 'Default Admin' and there being no surname as if this user is not there the defaultAdmin in _config will use an existing user.
Any other ideas? willr?
| 885 Views | ||
|
Page:
1
|
Go to Top |



