コード例 #1
0
 public function getResend(UserRepository $user_gestion, Request $request)
 {
     if ($request->session()->has('user_id')) {
         $user = $user_gestion->getById($request->session()->get('user_id'));
         $this->dispatch(new SendMail($user));
         return redirect('/')->with('ok', trans('front/verify.resend'));
     }
     return redirect('/');
 }
コード例 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $routeName = 'user';
     $routeMethod = 'edit';
     $user = $this->user->getById($id);
     $roles = $this->role->getAllOrderedBy('name');
     $data = compact('routeName', 'routeMethod', 'user', 'roles');
     \Clockwork::info($user);
     return view('admin.sections.user.edit', $data);
 }
コード例 #3
0
ファイル: ViewUserRequest.php プロジェクト: weopendata/medea
 /**
  * Determine if the user is authorized to make this request.
  *
  * @return bool
  */
 public function authorize(HttpRequest $request, UserRepository $users)
 {
     // Get the id of the user from the route
     $userId = $request->persons;
     $user = $users->getById($userId);
     // User not found
     if (empty($user)) {
         abort(404);
     }
     // The person to view the profile of
     $this->person = new Person();
     $this->person->setNode($user);
     // The profile can be viewed when
     // * The profile is set to be accessible
     // * The logged in user is viewing his own profile
     // * The user of the profile has set a certain role to allow to view the profile
     // and the logged in user has a role that belongs to that set
     return $this->person->profileAccessLevel == 4 || !empty($request->user()) && ($request->user()->id == $this->person->id || $request->user()->hasRole($this->person->getProfileAllowedRoles()));
 }
コード例 #4
0
ファイル: FindController.php プロジェクト: weopendata/medea
 /**
  * Display the specified resource.
  *
  * @param ShowFindRequest $request
  *
  * @return \Illuminate\Http\Response
  */
 public function show(ShowFindRequest $request)
 {
     $find = $request->getFind();
     // If the user is not owner of the find and not a researcher, obscure the location to 1km accuracy
     if (empty($user) || !empty($find['person']['identifier']) && $find['person']['identifier'] != $user->id && !in_array('onderzoeker', $user->getRoles())) {
         if (!empty($find['findSpot']['location']['lat'])) {
             $find['findSpot']['location']['lat'] = round($find['findSpot']['location']['lat'] / 2, 2) * 2;
             $find['findSpot']['location']['lng'] = round($find['findSpot']['location']['lng'] / 2, 2) * 2;
         }
     }
     $users = new UserRepository();
     // Check if the user of the find allows their name to be displayed on the find details
     $findUser = $users->getById($find['person']['identifier']);
     $publicUserInfo = [];
     if (!empty($findUser)) {
         $person = new Person();
         $person->setNode($findUser);
         if ($person->showNameOnPublicFinds) {
             $publicUserInfo['name'] = $person->lastName . ' ' . $person->firstName;
         }
         // Should there be a link to the profile page
         if ($person->profileAccessLevel == 4 || !empty($request->user()) && ($request->user()->id == $person->id || $request->user()->hasRole($person->getProfileAllowedRoles()))) {
             $publicUserInfo['id'] = $person->id;
         }
     }
     return view('pages.finds-detail', ['fields' => $this->list_values->getFindTemplate(), 'find' => $find, 'publicUserInfo' => $publicUserInfo]);
 }
コード例 #5
0
 public function getUpdate($id)
 {
     $user = $this->userRepository->getById($id);
     $roles = $this->roleRepository->listForArr();
     return view('weyi.user.update', compact('user', 'roles'));
 }