Author: uncleringo
Date: 2010-03-15 14:06:13 +0100 (Mon, 15 Mar 2010)
New Revision: 28530
Modified:
plugins/sfTrafficCMSPlugin/trunk/lib/sfTrafficGuardSecurityUser.class.php
Log:
Added hasAccess function
Modified:
plugins/sfTrafficCMSPlugin/trunk/lib/sfTrafficGuardSecurityUser.class.php
===================================================================
--- plugins/sfTrafficCMSPlugin/trunk/lib/sfTrafficGuardSecurityUser.class.php
2010-03-15 12:06:49 UTC (rev 28529)
+++ plugins/sfTrafficCMSPlugin/trunk/lib/sfTrafficGuardSecurityUser.class.php
2010-03-15 13:06:13 UTC (rev 28530)
@@ -16,4 +16,49 @@
return false;
}
-}
+
+ public function hasAccess()
+ {
+ $allowed = false;
+
+ /**
+ * Check for specified allowed groups
+ */
+ if ($groups = sfConfig::get('app_sf_guard_plugin_allowed_groups', false))
+ {
+ foreach ($this->getGroups() as $group)
+ {
+ if (in_array($group->name, $groups))
+ {
+ $allowed = true;
+ break;
+ }
+ }
+ }
+ /**
+ * Check for specified denied groups
+ */
+ else if ($groups = sfConfig::get('app_sf_guard_plugin_denied_groups',
false))
+ {
+ $allowed = true;
+
+ foreach ($this->getGroups() as $group)
+ {
+ if (in_array($group->name, $groups))
+ {
+ $allowed = false;
+ break;
+ }
+ }
+ }
+ /**
+ * Nothing specified means we're ok
+ */
+ else
+ {
+ $allowed = true;
+ }
+
+ return $allowed;
+ }
+}
\ No newline at end of file
--
You received this message because you are subscribed to the Google Groups
"symfony SVN" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/symfony-svn?hl=en.