vendor/sulu/sulu/src/Sulu/Bundle/SecurityBundle/Entity/AccessControl.php line 17

Open in your IDE?
  1. <?php
  2. /*
  3.  * This file is part of Sulu.
  4.  *
  5.  * (c) Sulu GmbH
  6.  *
  7.  * This source file is subject to the MIT license that is bundled
  8.  * with this source code in the file LICENSE.
  9.  */
  10. namespace Sulu\Bundle\SecurityBundle\Entity;
  11. use Sulu\Component\Security\Authentication\RoleInterface;
  12. use Sulu\Component\Security\Authorization\AccessControl\AccessControlInterface;
  13. class AccessControl implements AccessControlInterface
  14. {
  15.     /**
  16.      * @var int
  17.      */
  18.     private $id;
  19.     /**
  20.      * The role this access control rule is valid for.
  21.      *
  22.      * @var RoleInterface
  23.      */
  24.     private $role;
  25.     /**
  26.      * Holds the permissions as a bitmask.
  27.      *
  28.      * @var int
  29.      */
  30.     private $permissions;
  31.     /**
  32.      * The id of the model this access control rule applies to.
  33.      *
  34.      * @var string
  35.      */
  36.     private $entityId;
  37.     /**
  38.      * The id as integer representation of the model this access control rule applies to.
  39.      *
  40.      * @var int|null
  41.      */
  42.     private $entityIdInteger;
  43.     /**
  44.      * The class of the model this access control rule applies to.
  45.      *
  46.      * @var string
  47.      */
  48.     private $entityClass;
  49.     public function getId()
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getRole()
  54.     {
  55.         return $this->role;
  56.     }
  57.     public function setRole($role)
  58.     {
  59.         $this->role $role;
  60.     }
  61.     public function getPermissions()
  62.     {
  63.         return $this->permissions;
  64.     }
  65.     public function setPermissions($permissions)
  66.     {
  67.         $this->permissions $permissions;
  68.     }
  69.     public function getEntityId()
  70.     {
  71.         if ($this->entityIdInteger) {
  72.             return $this->entityIdInteger;
  73.         }
  74.         return $this->entityId;
  75.     }
  76.     public function setEntityId($entityId)
  77.     {
  78.         $this->entityId = (string) $entityId;
  79.         if (\is_numeric($entityId)) {
  80.             $this->entityIdInteger = (int) $entityId;
  81.         }
  82.     }
  83.     public function getEntityClass()
  84.     {
  85.         return $this->entityClass;
  86.     }
  87.     public function setEntityClass($entityClass)
  88.     {
  89.         $this->entityClass $entityClass;
  90.     }
  91. }