public function handleNotification(INotification $note) { switch ($note->getName()) { case AppFacade::NEW_USER: $this->clearForm(); break; case AppFacade::USER_ADDED: $this->rolePanel->user = $note->getBody(); $this->roleProxy->addItem(new RoleVO($this->rolePanel->user->username)); $this->clearForm(); break; case AppFacade::USER_UPDATED: $this->clearForm(); break; case AppFacade::USER_DELETED: $this->clearForm(); break; case AppFacade::CANCEL_SELECTED: $this->clearForm(); break; case AppFacade::USER_SELECTED: $this->rolePanel->user = $note->getBody(); $this->rolePanel->setUserRoles($this->roleProxy->getUserRoles($this->rolePanel->user->username)); $this->rolePanel->reset(); break; case AppFacade::ADD_ROLE_RESULT: $note->getBody() && $this->rolePanel->addUserRole($note->getType(), RoleEnum::getValue($note->getType())); $this->rolePanel->reset(); break; } }
public function setUserRoles(array $roles) { $this->roleListStore->refClear(); if (count($roles) > 0) { foreach ($roles as $roleEnum) { $userRoles[$roleEnum] = RoleEnum::getValue($roleEnum); } $this->roleListStore->refInsert(isset($userRoles) ? $userRoles : array()); } }