summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorSimon2011-03-29 14:32:27 +0200
committerSimon2011-03-29 14:32:27 +0200
commite3a8a0dd56fd9e118a5e676c794e6fb6bc1f01bd (patch)
tree32dfd37c655d53c52a1652c7e4f4ce0b4181252a /library
parentLeere Filter (Filter ohne Filterentry) werden nun auch berücksichtigt (diff)
parentstatic functions für die ACL (diff)
downloadpbs2-e3a8a0dd56fd9e118a5e676c794e6fb6bc1f01bd.tar.gz
pbs2-e3a8a0dd56fd9e118a5e676c794e6fb6bc1f01bd.tar.xz
pbs2-e3a8a0dd56fd9e118a5e676c794e6fb6bc1f01bd.zip
Merge branch 'master' of openslx.org:lsfks/master-teamprojekt/pbs2
Diffstat (limited to 'library')
-rw-r--r--library/Pbs/Acl.php35
1 files changed, 35 insertions, 0 deletions
diff --git a/library/Pbs/Acl.php b/library/Pbs/Acl.php
new file mode 100644
index 0000000..bad0277
--- /dev/null
+++ b/library/Pbs/Acl.php
@@ -0,0 +1,35 @@
+<?php
+
+class Pbs_Acl
+{
+ public static function checkRight($rightShortcut) {
+ $userIDsNamespace = Zend_Session::namespaceGet('userIDs');
+ $roleID = $userIDsNamespace['roleID'];
+ $rightRolesMapper = new Application_Model_RightRolesMapper();
+ $rightroles = $rightRolesMapper->findBy('roleID', $roleID);
+ $rightMapper = new Application_Model_RightMapper();
+ foreach($rightroles as $rightrole) {
+ $right = $rightMapper->find($rightrole['rightID']);
+ if($right->getShortcut() == $rightShortcut) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static function checkRightByMembershipID($membershipID, $rightShortcut) {
+ $membershipMapper = new Application_Model_MembershipMapper();
+ $membership = $membershipMapper->find($membershipID);
+ $rightRolesMapper = new Application_Model_RightRolesMapper();
+ $rightroles = $rightRolesMapper->findBy('roleID', $membership->getRoleID());
+ $rightMapper = new Application_Model_RightMapper();
+ foreach($rightroles as $rightrole) {
+ $right = $rightMapper->find($rightrole['rightID']);
+ if($right->getShortcut == $rightShortcut) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
+