예제 #1
0
 public function createRoles()
 {
     $this->sa = Role::register('sa');
     $this->user_role = Role::register('user');
     $this->admin = Role::register('admin');
     $this->user_admin = Role::register('user_admin');
     $this->website_moderator = Role::register('website_moderator');
     $this->book_moderator = Role::register('book_moderator');
     $this->manager->persist($this->sa);
     $this->manager->persist($this->user_role);
     $this->manager->persist($this->admin);
     $this->manager->persist($this->user_admin);
     $this->manager->persist($this->website_moderator);
     $this->manager->persist($this->book_moderator);
     $this->manager->flush();
 }
예제 #2
0
 protected function setupTestData()
 {
     //USER
     $fname = new Name('Karl');
     $lname = new Name('Van Iseghem');
     $uname = new Username('*****@*****.**');
     $pwd = new HashedPassword(bcrypt('password'));
     $gender = new Gender(Gender::MALE);
     $email = new Email($uname->toString());
     $this->karl = User::register($fname, $lname, $uname, $pwd, $email, $gender);
     //ORGANIZATION
     $orgName = new Name('VBS De Klimtoren');
     $domainName = new DomainName('klimtoren.be');
     $this->klimtoren = Organization::register($orgName, $domainName);
     //ACL
     $role_admin = Role::register('admin');
     $role_sa = Role::register('sa');
     $this->roleUser = Role::register('user');
     UserRole::register($this->karl, $role_admin, $this->klimtoren);
     UserRole::register($this->karl, $role_sa, $this->klimtoren);
     $this->userData = ['first_name' => 'Karl', 'last_name' => 'Van Iseghem', 'username' => '*****@*****.**', 'password' => 'password', 'gender' => 'M'];
 }
 /**
  * {@inheritDoc}
  */
 public function revokeAllPermissions()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'revokeAllPermissions', array());
     return parent::revokeAllPermissions();
 }
예제 #4
0
 /**
  * @test
  * @group userServRoles
  */
 public function should_add_user_to_role()
 {
     $roleTest = Role::register('new_role');
     //TODO: add user to role
     //how can this be tested?
     //via UserRole::register etc
     $this->roleRepo->shouldReceive('get')->andReturn($roleTest);
     $this->userRoleRepo->shouldReceive('register');
     $this->userService->addUserToRole($this->karl, 'new_role', $this->klimtoren);
 }