22979 Posts in 11808 Topics by 2827 members
|Go to End|
20 September 2010 at 9:48pm
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?
22 September 2010 at 5:06pm
Admins are usualy in their own group. You can check that with inGroup() of the class Member.
22 September 2010 at 6:32pm
Or use Permission::check('ADMIN'); to check for any admin rights on the current member.
22 September 2010 at 8:18pm
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...
and within "Security -> Security Groups -> Administrators" the user...
Swaiba - Swaiba - email@example.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)
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.
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?
|Go to Top|