Esempio n. 1
0
 public function testLabel()
 {
     $role = new Role();
     $label = 'Test role';
     $this->assertEmpty($role->getLabel());
     $role->setLabel($label);
     $this->assertEquals($label, $role->getLabel());
     $this->assertEquals($label, (string) $role);
 }
 /**
  * Save role
  *
  * @param Role $role
  * @return bool
  */
 public function process(Role $role)
 {
     if (in_array($this->request->getMethod(), array('POST', 'PUT'))) {
         $this->form->submit($this->request);
         if ($this->form->isValid()) {
             $appendUsers = $this->form->get('appendUsers')->getData();
             $removeUsers = $this->form->get('removeUsers')->getData();
             $role->setRole(strtoupper(trim(preg_replace('/[^\\w\\-]/i', '_', $role->getLabel()))));
             $this->onSuccess($role, $appendUsers, $removeUsers);
             $this->processPrivileges($role);
             return true;
         }
     } else {
         $this->setRolePrivileges($role);
     }
     return false;
 }
 /**
  * {@inheritDoc}
  */
 public function getLabel()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getLabel', array());
     return parent::getLabel();
 }