You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

AclManager.php 977B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace SCF\Core;
  3. class AclManager {
  4. /**
  5. * @var mixed
  6. */
  7. private $_db;
  8. /**
  9. * @var
  10. */
  11. private $_userGroup;
  12. /**
  13. * @var
  14. */
  15. private $_acl;
  16. /**
  17. * AclManager constructor.
  18. * @param Database $db
  19. * @param $userGroupId
  20. */
  21. public function __construct(Database $db, $userGroupId)
  22. {
  23. $this->_db = $db;
  24. $this->_userGroup = $userGroupId;
  25. $this->getAcl();
  26. }
  27. /**
  28. *
  29. */
  30. private function getAcl()
  31. {
  32. $this->_db->query("SELECT * FROM system_usergroups WHERE guid = :groupId LIMIT 0,1");
  33. $this->_db->bind(':groupId', $this->_userGroup);
  34. $this->_acl = $this->_db->single();
  35. }
  36. /**
  37. * @param $value
  38. * @return string
  39. */
  40. public function acl($value)
  41. {
  42. if(isset($this->_acl[$value])) {
  43. return $this->_acl[$value];
  44. }
  45. else {
  46. return 'N/A';
  47. }
  48. }
  49. }