Teknik is a suite of services with attractive and functional interfaces. https://www.teknik.io/
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

Role.class.php 718B

123456789101112131415161718192021222324252627
  1. <?php
  2. class Role
  3. {
  4. protected $permissions;
  5. protected function __construct() {
  6. $this->permissions = array();
  7. }
  8. // return a role object with associated permissions
  9. public static function getRolePerms($role_id, $db)
  10. {
  11. $role = new Role();
  12. $db->select_raw("role_perm as rp JOIN permissions as p ON rp.perm_id = p.perm_id", "WHERE rp.role_id=?", array($role_id), "p.perm_desc");
  13. foreach ($results as $result)
  14. {
  15. $role->permissions[$result["perm_desc"]] = true;
  16. }
  17. return $role;
  18. }
  19. // check if a permission is set
  20. public function hasPerm($permission) {
  21. return isset($this->permissions[$permission]);
  22. }
  23. }
  24. ?>