Пример #1
0
 public static function AllEventRoles($eventId)
 {
     return DB::transaction(function () use($eventId) {
         $permissionList = PermissionNames::AllEventPermissions($eventId);
         $permissions = self::createAllPermissions($permissionList);
         self::createPermissionRoles($permissions);
         $managerRole = self::EventManager($eventId, $permissions);
         return $managerRole;
     });
 }
Пример #2
0
 private function buildPermissionList($eventId)
 {
     $permissions = [];
     foreach (PermissionNames::AllEventPermissions($eventId) as $pname) {
         Log::debug("Checking permission {$pname} for " . Auth::user()->email);
         if (Entrust::can($pname)) {
             Log::debug("Permission enabled");
             $permissions[] = PermissionNames::normalizePermissionName($pname);
         }
     }
     return $permissions;
 }
Пример #3
0
 /**
  * Deletes a conference.
  */
 public function delete($id)
 {
     if (!Entrust::can(PermissionNames::ConferenceInfoEdit($id))) {
         return response("", 403);
     }
     DB::transaction(function () use($id) {
         $events = Event::where('conferenceID', $id)->get();
         $pnames = array_merge(PermissionNames::AllConferencePermissions($id), PermissionNames::ExclusiveConferencePermissions($id));
         $evtIds = [];
         foreach ($events as $e) {
             $pnames = array_merge($pnames, PermissionNames::AllEventPermissions($e->id));
             echo $e;
             $evtIds[] = $e->id;
         }
         Permission::whereIn('name', $pnames)->delete();
         RoleCreate::deleteConferenceRoles($id);
         RoleCreate::deleteEventRoles($evtIds);
         Conference::destroy($id);
     });
     Log::info("Conference with ID {$id} deleted");
     return '';
 }