/**
  * Update the specified resource in storage.
  *
  * @param $package
  * @return Response
  */
 public function postEdit(packageEditRequest $request, $id)
 {
     $package = package::find($id);
     $package->name = $request->name;
     $password = $request->password;
     $passwordConfirmation = $request->password_confirmation;
     if (!empty($password)) {
         if ($password === $passwordConfirmation) {
             $package->password = bcrypt($password);
         }
     }
     $package->save();
     AssignedRoles::where('package_id', '=', $package->id)->delete();
     foreach ($request->roles as $item) {
         $role = new AssignedRoles();
         $role->role_id = $item;
         $role->package_id = $package->id;
         $role->save();
     }
 }
 /**
  * Remove the specified user from storage.
  *
  * @param $user
  * @return Response
  */
 public function postDelete($user)
 {
     // Check if we are not trying to delete ourselves
     if ($user->id === Confide::user()->id) {
         // Redirect to the user management page
         return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.delete.impossible'));
     }
     AssignedRoles::where('user_id', $user->id)->delete();
     $id = $user->id;
     $user->delete();
     // Was the comment post deleted?
     $user = User::find($id);
     if (empty($user)) {
         // TODO needs to delete all of that user's content
         return Redirect::to('admin/users')->with('success', Lang::get('admin/users/messages.delete.success'));
     } else {
         // There was a problem deleting the user
         return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.delete.error'));
     }
 }
Пример #3
0
 /**
  * Remove the specified user from storage.
  *
  * @param $user
  * @return Response
  */
 public function postDelete($user)
 {
     // Check if we are not trying to delete ourselves
     if ($user->id === Confide::user()->id) {
         // Redirect to the user management page
         return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.delete.impossible'));
     }
     AssignedRoles::where('user_id', $user->id)->delete();
     $id = $user->id;
     $username = $user->username;
     $responseJson = xDockerEngine::authenticate(array('username' => $user->username, 'password' => md5($user->engine_key)));
     EngineLog::logIt(array('user_id' => Auth::id(), 'method' => 'authenticate', 'return' => $responseJson));
     $obj = json_decode($responseJson);
     if (!empty($obj) && $obj->status == 'OK') {
         $response = xDockerEngine::removeUsername(array('token' => $obj->token));
         Log::info('xDocker Engine user is deleted!');
     }
     if (!empty($obj) && $obj->status == 'error') {
         Log::error('xDocker Engine user deletion : Failed in authentication');
     } else {
         Log::error('xDocker Engine user deletion - Unexpected error');
     }
     $user->delete();
     // Was the comment post deleted?
     $user = User::find($id);
     if (empty($user)) {
         // TODO needs to delete all of that user's content
         return Redirect::to('admin/users')->with('success', Lang::get('admin/users/messages.delete.success'));
     } else {
         // There was a problem deleting the user
         return Redirect::to('admin/users')->with('error', Lang::get('admin/users/messages.delete.error'));
     }
 }
Пример #4
0
 public function eliminarRol()
 {
     $rol = Input::get("rol");
     $roles = AssignedRoles::where("role_id", "=", $rol)->get();
     if (count($roles) > 0) {
         return Response::json(array("estado" => "1"));
     } else {
         $role = Role::find($rol);
         $role->delete();
         $permisos = PermisosRoles::where("role_id", "=", $rol)->delete();
         $html = (string) View::make("dashboard.roles.rolesTablaRoles")->with(array("roles" => Role::all()));
         return Response::json(array("estado" => "2", "html" => $html));
     }
 }