public function workgroupDeleted(UMEvent $e)
 {
     if ($e->getSource() instanceof AbstractEyeosWorkgroup) {
         $workgroupDirPath = UMManager::getEyeosWorkgroupDirectory($e->getSource()->getName());
         AdvancedPathLib::rmdirs($workgroupDirPath);
     }
 }
 public function userDeleted(UMEvent $e)
 {
     if ($e->getSource() instanceof AbstractEyeosUser) {
         //Send message to the BUS
         $message = new ClientBusMessage('ummanager', 'userDeleted', $e->getSource()->getId());
         ClientMessageBusController::getInstance()->queueMessage($message);
         MetaManager::getInstance()->deleteMeta($e->getSource());
     }
 }
 public function userCreated(UMEvent $e)
 {
     $newUser = $e->getSource();
     if ($newUser instanceof AbstractEyeosUser) {
         $calendar = CalendarManager::getInstance()->getNewCalendar();
         $calendar->setOwnerId($newUser->getId());
         $calendar->setName($newUser->getName());
         $calendar->setDescription($newUser->getName() . '\'s personal calendar.');
         $calendar->setTimezone(0);
         CalendarManager::getInstance()->saveCalendar($calendar);
         $prefs = CalendarManager::getInstance()->getCalendarPreferences($newUser->getId(), $calendar->getId());
         $prefs->setVisible(true);
         CalendarManager::getInstance()->saveCalendarPreferences($prefs);
     }
 }
示例#4
0
 public function userWorkgroupAssignationUpdated(UMEvent $e)
 {
     if ($e->getSource() instanceof IUserWorkgroupAssignation) {
         $assignation = $e->getSource();
         $oldAssignation = $e->getRelatedSource();
         $userId = $assignation->getUserId();
         $groupId = $assignation->getWorkgroupId();
         if ($assignation->getStatus() === WorkgroupConstants::STATUS_BANNED) {
             $NetSyncMessage = new NetSyncMessage('NSGroup', 'bannedFromWorkgroup', $userId, $groupId);
             NetSyncController::getInstance()->send($NetSyncMessage);
         }
         if (($oldAssignation->getStatus() === WorkgroupConstants::STATUS_PENDING || $oldAssignation->getStatus() === WorkgroupConstants::STATUS_INVITED) && $assignation->getStatus() === WorkgroupConstants::STATUS_MEMBER) {
             $NetSyncMessage = new NetSyncMessage('NSGroup', 'confirmMembership', $userId, $groupId);
             NetSyncController::getInstance()->send($NetSyncMessage);
         }
     }
 }
示例#5
0
 public function userCreated(UMEvent $e)
 {
     if ($e->getSource() instanceof AbstractEyeosUser) {
         SearchFileRecollPlugin::createRecollUserConf($e->getSource());
     }
 }
 public function userWorkgroupAssignationUpdated(UMEvent $e)
 {
     if ($e->getSource() instanceof IUserWorkgroupAssignation) {
         $assignation = $e->getSource();
         $oldAssignation = $e->getRelatedSource();
         $userId = $assignation->getUserId();
         $groupId = $assignation->getWorkgroupId();
         if ($assignation->getStatus() === WorkgroupConstants::STATUS_BANNED) {
             $event1 = new EyeosEventNotification();
             $event1->setType('Groups_BannedUser');
             $event1->setEventData(array('userId' => $userId, 'groupId' => $groupId));
             $eventManager = new EventNotificationManager();
             //Send event to the owner
             $eventManager->sendEventByType($event1);
             //Send event to the banned user
             $event2 = new EyeosEventNotification();
             $event2->setType('Groups_BannedUser');
             $event2->setEventData(array('userId' => $userId, 'groupId' => $groupId));
             $event2->setReceiver($userId);
             $eventManager->sendEventByType($event2);
         }
         if (($oldAssignation->getStatus() === WorkgroupConstants::STATUS_PENDING || $oldAssignation->getStatus() === WorkgroupConstants::STATUS_INVITED) && $assignation->getStatus() === WorkgroupConstants::STATUS_MEMBER) {
             $event = new EyeosEventNotification();
             $event->setType('Groups_ConfirmedUser');
             $event->setEventData($groupId);
             $event->setReceiver($userId);
             $eventManager = new EventNotificationManager();
             $eventManager->sendEventByType($event);
             // Closing the relatives events in case of pending request...
             $eventData = serialize(array('groupId' => $groupId, 'userId' => $userId));
             $info = new EyeosEventNotification();
             $info->setType('Groups_RequestMembershipReceiver');
             $info->setEventData($eventData);
             $info->setIsQuestion(1);
             $eventManager = new EventNotificationManager();
             $eventsToRemove = $eventManager->searchEvents($info);
             foreach ($eventsToRemove as $event) {
                 $abstractEvent = new EyeosEventNotification();
                 $abstractEvent->setEventInformation($event);
                 $abstractEvent->setHasEnded(true);
                 $eventManager->updateEventNotification($abstractEvent);
             }
             // Closing the relatives events in case of invited request...
             $eventData = serialize(array('groupId' => $groupId));
             $info = new EyeosEventNotification();
             $info->setType('Groups_InvitedUsersReceiver');
             $info->setEventData($eventData);
             $info->setIsQuestion(1);
             $eventManager = new EventNotificationManager();
             $eventsToRemove = $eventManager->searchEvents($info);
             foreach ($eventsToRemove as $event) {
                 $abstractEvent = new EyeosEventNotification();
                 $abstractEvent->setEventInformation($event);
                 $abstractEvent->setHasEnded(true);
                 $eventManager->updateEventNotification($abstractEvent);
             }
         }
         $NetSyncMessage = new NetSyncMessage('NSGroup', 'userWorkgroupAssignationUpdated', $userId, $groupId);
         NetSyncController::getInstance()->send($NetSyncMessage);
     }
 }
示例#7
0
 /**
  * Creates a user.
  *
  * @param IUser $user
  * @throws EyeUMException User already exists.
  */
 public function createUser(IUser $user, $skel = 'default')
 {
     self::getPrincipalsManagerInstance()->createUser($user);
     $this->logger->info('User created: ' . $user);
     $event = new UMEvent($user);
     $event->setSkel($skel);
     $this->fireEvent('userCreated', $event);
 }
示例#8
0
 public function userDeleted(UMEvent $e)
 {
     self::$Logger->debug("User deleted! " . $e->getSource()->getId());
     //self::$Logger->debug($e);
     $dao = StorageManager::getInstance()->getHandler(SQL_DAOHANDLER);
     try {
         $sql = 'DELETE FROM `messages` WHERE `from` = \'' . $e->getSource()->getId() . '\'';
         $dao->send($sql);
     } catch (Exception $e) {
         self::$Logger->debug("Error trying to delete garbage of user in messages (from)");
         self::$Logger->debug($e);
     }
     try {
         $sql = 'DELETE FROM `messages` WHERE `to` = \'' . $e->getSource()->getId() . '\'';
         $dao->send($sql);
     } catch (Exception $e) {
         self::$Logger->debug("Error trying to delete garbage of user in messages (to)");
         self::$Logger->debug($e);
     }
     try {
         $sql = 'DELETE FROM `ShareableVirtualFilesHandler` WHERE `shareableObjectId` = \'' . $e->getSource()->getId() . '\'';
         $dao->send($sql);
     } catch (Exception $e) {
         self::$Logger->debug("Error trying to delete garbage of user in ShareableVirtualFilesHandler");
         self::$Logger->debug($e);
     }
 }