vendor/sulu/sulu/src/Sulu/Bundle/SecurityBundle/Entity/Permission.php line 23

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 JMS\Serializer\Annotation\ExclusionPolicy;
  12. use JMS\Serializer\Annotation\Expose;
  13. use Sulu\Component\Security\Authentication\RoleInterface;
  14. /**
  15.  * Permission.
  16.  *
  17.  * @ExclusionPolicy("all");
  18.  */
  19. class Permission
  20. {
  21.     /**
  22.      * @var string
  23.      *
  24.      * @Expose
  25.      */
  26.     private $context;
  27.     /**
  28.      * @var int
  29.      *
  30.      * @Expose
  31.      */
  32.     private $permissions;
  33.     /**
  34.      * @var int
  35.      *
  36.      * @Expose
  37.      */
  38.     private $id;
  39.     /**
  40.      * @var RoleInterface
  41.      */
  42.     private $role;
  43.     /**
  44.      * @var string|null
  45.      *
  46.      * @Expose
  47.      */
  48.     private $module;
  49.     /**
  50.      * Set context.
  51.      *
  52.      * @param string $context
  53.      *
  54.      * @return Permission
  55.      */
  56.     public function setContext($context)
  57.     {
  58.         $this->context $context;
  59.         return $this;
  60.     }
  61.     /**
  62.      * Get context.
  63.      *
  64.      * @return string
  65.      */
  66.     public function getContext()
  67.     {
  68.         return $this->context;
  69.     }
  70.     /**
  71.      * Set permissions.
  72.      *
  73.      * @param int $permissions
  74.      *
  75.      * @return Permission
  76.      */
  77.     public function setPermissions($permissions)
  78.     {
  79.         $this->permissions $permissions;
  80.         return $this;
  81.     }
  82.     /**
  83.      * Get permissions.
  84.      *
  85.      * @return int
  86.      */
  87.     public function getPermissions()
  88.     {
  89.         return $this->permissions;
  90.     }
  91.     /**
  92.      * Get id.
  93.      *
  94.      * @return int
  95.      */
  96.     public function getId()
  97.     {
  98.         return $this->id;
  99.     }
  100.     /**
  101.      * Set role.
  102.      *
  103.      * @param RoleInterface $role
  104.      *
  105.      * @return Permission
  106.      */
  107.     public function setRole(RoleInterface $role null)
  108.     {
  109.         $this->role $role;
  110.         return $this;
  111.     }
  112.     /**
  113.      * Get role.
  114.      *
  115.      * @return RoleInterface
  116.      */
  117.     public function getRole()
  118.     {
  119.         return $this->role;
  120.     }
  121.     /**
  122.      * Set module.
  123.      *
  124.      * @param string $module
  125.      *
  126.      * @return Permission
  127.      */
  128.     public function setModule($module)
  129.     {
  130.         $this->module $module;
  131.         return $this;
  132.     }
  133.     /**
  134.      * Get module.
  135.      *
  136.      * @return string|null
  137.      */
  138.     public function getModule()
  139.     {
  140.         return $this->module;
  141.     }
  142.     public function __toString()
  143.     {
  144.         return $this->context;
  145.     }
  146. }