예제 #1
0
 public function onDelete(OW_Event $event)
 {
     $params = $event->getParams();
     if ($params["entityType"] != self::ENTITY_TYPE) {
         return;
     }
     foreach ($params["entityIds"] as $groupId) {
         $this->service->deleteGroup($groupId);
     }
 }
예제 #2
0
파일: groups.php 프로젝트: vazahat/dudex
 public function delete($params)
 {
     if (empty($params['groupId'])) {
         throw new Redirect404Exception();
     }
     if (!OW::getUser()->isAuthenticated()) {
         throw new AuthenticateException();
     }
     $groupDto = $this->service->findGroupById($params['groupId']);
     if (empty($groupDto)) {
         throw new Redirect404Exception();
     }
     $isOwner = OW::getUser()->getId() == $groupDto->userId;
     $isModerator = OW::getUser()->isAuthorized('groups');
     if (!$isOwner && !$isModerator) {
         throw new Redirect403Exception();
     }
     $this->service->deleteGroup($groupDto->id);
     OW::getFeedback()->info(OW::getLanguage()->text('groups', 'delete_complete_msg'));
     $this->redirect(OW::getRouter()->urlForRoute('groups-index'));
 }