Ejemplo n.º 1
0
 /**
  * Constructor.
  */
 public function __construct(Role $role, AbstractRoleSubject $subject)
 {
     $this->role = $role;
     $details = array('role' => array('name' => $role->getTranslationKey()));
     if ($role->getWorkspace()) {
         $details['workspace'] = array('name' => $role->getWorkspace()->getName(), 'id' => $role->getWorkspace()->getId());
     }
     if ($subject instanceof User) {
         $details['receiverUser'] = array('firstName' => $subject->getFirstName(), 'lastName' => $subject->getLastName());
         $this->receiver = $subject;
     } else {
         $details['receiverGroup'] = array('name' => $subject->getName());
         $this->receiverGroup = $subject;
     }
     $this->details = $details;
     parent::__construct($this->getActionKey(), $details, $this->receiver, $this->receiverGroup, null, $role, $role->getWorkspace());
 }
Ejemplo n.º 2
0
 /**
  * Constructor.
  */
 public function __construct(Role $role, AbstractRoleSubject $subject)
 {
     $receiver = null;
     $receiverGroup = null;
     $details = array('role' => array('name' => $role->getTranslationKey()));
     if ($role->getWorkspace()) {
         $details['workspace'] = array('name' => $role->getWorkspace()->getName());
     }
     if ($subject instanceof User) {
         $details['receiverUser'] = array('firstName' => $subject->getFirstName(), 'lastName' => $subject->getLastName());
         $action = self::ACTION_USER;
         $receiver = $subject;
     } else {
         $details['receiverGroup'] = array('name' => $subject->getName());
         $action = self::ACTION_GROUP;
         $receiverGroup = $subject;
     }
     parent::__construct($action, $details, $receiver, $receiverGroup, null, $role, $role->getWorkspace());
 }