/**
  * @param  $input
  * @param  $roles
  * @param  $permissions
  * @throws GeneralException
  * @throws UserNeedsRolesException
  * @return bool
  */
 public function create($input, $roles, $permissions)
 {
     $user = $this->createUserStub($input);
     if ($user->save()) {
         //User Created, Validate Roles
         $this->validateRoleAmount($user, $roles['assignees_roles']);
         //Attach new roles
         $user->attachRoles($roles['assignees_roles']);
         //Attach other permissions
         $user->attachPermissions($permissions['permission_user']);
         //Send confirmation email if requested
         if (isset($input['confirmation_email']) && $user->confirmed == 0) {
             $this->auth->resendConfirmationEmail($user->id);
         }
         return true;
     }
     throw new GeneralException('There was a problem creating this user. Please try again.');
 }
Esempio n. 2
0
 /**
  * @param $input
  * @param $roles
  * @param $permissions
  * @return bool
  * @throws GeneralException
  * @throws UserNeedsRolesException
  */
 public function create($input, $roles, $permissions)
 {
     $user = $this->createUserStub($input);
     $user->razon_social = $input['razon_social'];
     $user->encargado = $input['encargado'];
     if ($user->save()) {
         //User Created, Validate Roles
         $this->validateRoleAmount($user, $roles['assignees_roles']);
         //Attach new roles
         $user->attachRoles($roles['assignees_roles']);
         //Attach other permissions
         $user->attachPermissions($permissions['permission_user']);
         //Send confirmation email if requested
         if (isset($input['confirmation_email']) && $user->confirmed == 0) {
             $this->auth->resendConfirmationEmail($user->id);
         }
         return true;
     }
     throw new GeneralException('Se encontro un problema creando este provedor. Intente nuevamente.');
 }
 /**
  * @param $input
  * @param $roles
  * @param $permissions
  * @return bool
  * @throws GeneralException
  * @throws UserNeedsRolesException
  */
 public function create($input, $roles, $permissions, $organizations)
 {
     $user = $this->createUserStub($input);
     if (!empty($organizations['users_organization']) && $organizations['users_organization'] != 'none') {
         $organization = $this->organization->findOrThrowException($organizations['users_organization']);
         $user->organization()->associate($organization);
     }
     $rolecheck = $this->checkUserRoleLevel($roles, $user);
     if ($user->save()) {
         $this->checkUserRolesCount($roles);
         if ($rolecheck) {
             $this->flushRoles($roles, $user);
         }
         $this->flushPermissions($permissions, $user);
         $user->save();
         //Send confirmation email if requested
         if (isset($input['confirmation_email']) && $user->confirmed == 0) {
             $this->auth->resendConfirmationEmail($user->id);
         }
         return true;
     }
     throw new GeneralException('There was a problem creating this user. Please try again.');
 }
Esempio n. 4
0
 /**
  * @param $user_id
  * @param AuthenticationContract $auth
  * @return mixed
  */
 public function resendConfirmationEmail($user_id, AuthenticationContract $auth)
 {
     $auth->resendConfirmationEmail($user_id);
     return redirect()->back()->withFlashSuccess("A new confirmation e-mail has been sent to the address on file.");
 }
Esempio n. 5
0
 /**
  * @param $user_id
  * @param AuthenticationContract $auth
  * @param ResendConfirmationEmailRequest $request
  * @return mixed
  */
 public function resendConfirmationEmail($user_id, AuthenticationContract $auth, ResendConfirmationEmailRequest $request)
 {
     $auth->resendConfirmationEmail($user_id);
     return redirect()->back()->withFlashSuccess(trans("alerts.users.confirmation_email"));
 }