예제 #1
0
 /**
  * Redefine constructor for RBAC
  *
  * @access public
  *
  * @param Adapter $connection
  *
  * @result void
  */
 public function __construct(Adapter $connection)
 {
     parent::__construct($connection);
     if (!empty($params['roles'])) {
         $this->roles = $this->tree($params['roles']);
     }
 }
예제 #2
0
 /**
  * Check privileges to operation
  *
  * @access public
  *
  * @param integer $userId user id
  * @param string $action checked action
  * @param array $data action params
  *
  * @return boolean
  * @throws \Micro\Base\Exception
  */
 public function check($userId, $action, array $data = [])
 {
     return $this->db->exists('rbac_role', ['name' => $action]) ? parent::check($userId, $action, $data) : false;
 }