示例#1
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $model = AdminUser::findOrFail($id);
     $modules = Module::all();
     $groups = Group::all();
     $usergroups = Sentry::findUserByID($id)->getGroups();
     return View::make("CoreCms::user.edit")->with("model", $model)->with("groups", $groups)->with("modules", $modules)->with("usergroups", $usergroups);
 }
示例#2
0
 public function setSuperuserAttribute($isSuperUser)
 {
     // Return if there is no change to be made
     if ($isSuperUser == $this->superuser) {
         return;
     }
     // Only other super admins should be able to change a users
     // Super admin permission level
     $user = Sentry::findUserByID(Auth::user()->id);
     if ($user->isSuperUser()) {
         $permissions = $this->getPermissions();
         $permissions['superuser'] = (bool) $isSuperUser;
         $this->permissions = $permissions;
     } else {
         throw new Exception("You do not have permission to create or edit super users", 1);
     }
 }