/** * Administrator can view settings of a certain user * * @param integer $userId * @param Request $request * * @return */ public function userSettings($userId, Request $request) { if (empty($request->user()) || !$request->user()->hasRole('administrator')) { return redirect('/'); } $user = $this->users->getById($userId); if (empty($user)) { abort(404); } // The person to view the profile of $person = new Person(); $person->setNode($user); $fullUser = $user->getProperties(); unset($fullUser['created_at']); unset($fullUser['MEDEA_UUID']); unset($fullUser['password']); unset($fullUser['remember_token']); unset($fullUser['token']); unset($fullUser['updated_at']); unset($fullUser['verified']); $fullUser['id'] = $userId; return view('pages.settings', ['accessLevels' => $this->getProfileAccessLevels(), 'roles' => $person->getRoles(), 'user' => $fullUser]); }
/** * Deliver a registration email to the admin * * @param Person $user * @return void */ public function sendRegistrationToAdmin(Person $user) { $this->to = env('ADMIN_EMAIL'); $this->view = 'auth.emails.adminconfirm'; $roles_string = ''; foreach ($user->getRoles() as $role) { $roles_string .= $role . ','; } $roles_string = rtrim($roles_string, ','); $this->data = ['user' => $user, 'roles' => $roles_string]; $this->subject = 'Nieuwe registratie'; $this->deliver(); }
/** * Get all the bare nodes of a findEvent * * @param integer $limit * @param integer $offset * * @return array */ public function getAllWithRoles() { $client = $this->getClient(); $findLabel = $client->makeLabel($this->label); $findNodes = $findLabel->getNodes(); $data = []; foreach ($findNodes as $findNode) { $person = new Person(); $person->setNode($findNode); $personData = array_only($findNode->getProperties(), ['firstName', 'lastName', 'verified']); $personData['id'] = $findNode->getId(); $personData['personType'] = $person->getRoles(); $data[] = $personData; } return $data; }