예제 #1
0
 public function putVerify($groupId)
 {
     $this->beforeFilter('admin');
     $newGroup = (object) Input::all();
     if (!Group::isValidStatus($newGroup->status)) {
         throw new \Exception("Invalid value for verify request");
     }
     $group = Group::where('id', '=', $groupId)->first();
     if (!$group) {
         throw new \Exception("Invalid Group");
     }
     $group->status = $newGroup->status;
     DB::transaction(function () use($group) {
         $group->save();
         switch ($group->status) {
             case Group::STATUS_ACTIVE:
                 $group->createRbacRules();
                 break;
             case Group::STATUS_PENDING:
                 $group->destroyRbacRules();
                 break;
         }
     });
     return Response::json($group);
 }