def getVars(self): vars = wcomponents.WTemplated.getVars(self) #dictionary where the keys are names of false "indexes" for the user, and the values are IndexInformation objects indexes = CollaborationTools.getCollaborationPluginType().getOption("pluginsPerIndex").getValue() indexNames = set(i.getName() for i in indexes) indexList = ['all', None, 'Vidyo', 'EVO', 'CERNMCU', 'All Videoconference', None, 'WebcastRequest', 'RecordingRequest', 'All Requests'] vars["Indexes"] = [x for x in indexList if x is None or x in indexNames] vars["IndexInformation"] = fossilize(dict([(i.getName(), i) for i in indexes]), IIndexInformationFossil) vars["InitialIndex"] = self._queryParams["indexName"] vars["InitialViewBy"] = self._queryParams["viewBy"] vars["InitialOrderBy"] = self._queryParams["orderBy"] vars["InitialOnlyPending"] = self._queryParams["onlyPending"] vars["InitialConferenceId"] = self._queryParams["conferenceId"] vars["InitialCategoryId"] = self._queryParams["categoryId"] vars["InitialSinceDate"] = self._queryParams["sinceDate"] vars["InitialToDate"] = self._queryParams["toDate"] vars["InitialFromDays"] = self._queryParams["fromDays"] vars["InitialToDays"] = self._queryParams["toDays"] vars["InitialFromTitle"] = self._queryParams["fromTitle"] vars["InitialToTitle"] = self._queryParams["toTitle"] vars["InitialResultsPerPage"] = self._queryParams["resultsPerPage"] vars["InitialPage"] = self._queryParams["page"] vars["BaseURL"] = collaborationUrlHandlers.UHAdminCollaboration.getURL() vars["ConfCollaborationDisplay"] = collaborationUrlHandlers.UHCollaborationDisplay.getURL() if self._queryParams["queryOnLoad"]: ci = IndexesHolder().getById('collaboration') tz = self._rh._getUser().getTimezone() ##### minKey = None maxKey = None if self._queryParams['sinceDate']: minKey = setAdjustedDate(datetime.strptime(self._queryParams['sinceDate'].strip(), '%Y/%m/%d'), tz=tz) if self._queryParams['toDate']: maxKey = setAdjustedDate(datetime.strptime(self._queryParams['toDate'].strip(), '%Y/%m/%d'), tz=tz) if self._queryParams['fromTitle']: minKey = self._queryParams['fromTitle'].strip() if self._queryParams['toTitle']: maxKey = self._queryParams['toTitle'].strip() if self._queryParams['fromDays']: try: fromDays = int(self._queryParams['fromDays']) except ValueError, e: raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e) midnight = nowutc().replace(hour=0, minute=0, second=0) minKey = midnight - timedelta(days = fromDays) if self._queryParams['toDays']: try: toDays = int(self._queryParams['toDays']) except ValueError, e: raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e) midnight_1 = nowutc().replace(hour=23, minute=59, second=59) maxKey = midnight_1 + timedelta(days = toDays)
def _checkParams(self): CollaborationBase._checkParams(self) if 'type' in self._params: self._type = self._params['type'] else: raise CollaborationException(_("type parameter not set when trying to create a booking on meeting ") + str(self._conf.getId() )) if 'bookingParams' in self._params: pm = ParameterManager(self._params) self._bookingParams = pm.extract("bookingParams", pType=dict, allowEmpty = True) else: raise CollaborationException(_("Custom parameters for plugin ") + str(self._type) + _(" not set when trying to create a booking on meeting ") + str(self._conf.getId() ))
def _checkParams(self): CollaborationBase._checkParams(self) self._pluginName = self._params.pop('plugin') if not self._pluginName: raise CollaborationException(_("No 'plugin' paramater in CollaborationPluginService")) serviceName = self._params.pop('service') if not serviceName: raise CollaborationException(_("No 'service' paramater in CollaborationPluginService")) self._serviceClass = CollaborationTools.getServiceClass(self._pluginName, serviceName) if not self._serviceClass: raise CollaborationException(_("Service " + str(serviceName) + _("Service not found for plugin ") + str(self._pluginName) + _("in CollaborationPluginService")))
def _checkParams(self): AdminCollaborationBase._checkParams(self) user = self.getAW().getUser() if user: #someone is logged in. if not, AdminCollaborationBase's _checkProtection will take care of it self._tz = user.getTimezone() try: self._page = self._params.get("page", None) self._resultsPerPage = self._params.get("resultsPerPage", None) self._indexName = self._params['indexName'] self._viewBy = self._params['viewBy'] self._orderBy = self._params['orderBy'] minKey = None maxKey = None if self._params['sinceDate']: minKey = setAdjustedDate(parseDateTime(self._params['sinceDate'].strip()), tz = self._tz) if self._params['toDate']: maxKey = setAdjustedDate(parseDateTime(self._params['toDate'].strip()), tz = self._tz) if self._params['fromTitle']: minKey = self._params['fromTitle'].strip() if self._params['toTitle']: maxKey = self._params['toTitle'].strip() if self._params['fromDays']: try: fromDays = int(self._params['fromDays']) except ValueError, e: raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e) minKey = nowutc() - timedelta(days = fromDays) if self._params['toDays']: try: toDays = int(self._params['toDays']) except ValueError, e: raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e) maxKey = nowutc() + timedelta(days = toDays) self._minKey = minKey self._maxKey = maxKey self._onlyPending = self._params['onlyPending'] categoryId = self._params['categoryId'].strip() if categoryId: self._categoryId = categoryId else: self._categoryId = None conferenceId = self._params['conferenceId'].strip() if conferenceId: self._conferenceId = conferenceId else: self._conferenceId = None
def _checkProtection(self): if not RCCollaborationAdmin.hasRights( self) and not RCCollaborationPluginAdmin.hasRights( self, None, [self._bookingPlugin]): raise CollaborationException( _("You don't have the rights to perform this operation on this booking" ))
def getVars( self ): vars = wcomponents.WTemplated.getVars( self ) #dictionary where the keys are names of false "indexes" for the user, and the values are IndexInformation objects vars["Indexes"] = CollaborationTools.getCollaborationPluginType().getOption("pluginsPerIndex").getValue() vars["InitialIndex"] = self._queryParams["indexName"] vars["InitialViewBy"] = self._queryParams["viewBy"] vars["InitialOrderBy"] = self._queryParams["orderBy"] vars["InitialOnlyPending"] = self._queryParams["onlyPending"] vars["InitialConferenceId"] = self._queryParams["conferenceId"] vars["InitialCategoryId"] = self._queryParams["categoryId"] vars["InitialSinceDate"] = self._queryParams["sinceDate"] vars["InitialToDate"] = self._queryParams["toDate"] vars["InitialFromDays"] = self._queryParams["fromDays"] vars["InitialToDays"] = self._queryParams["toDays"] vars["InitialFromTitle"] = self._queryParams["fromTitle"] vars["InitialToTitle"] = self._queryParams["toTitle"] vars["InitialResultsPerPage"] = self._queryParams["resultsPerPage"] vars["InitialPage"] = self._queryParams["page"] vars["BaseURL"] = urlHandlers.UHAdminCollaboration.getURL() if self._queryParams["queryOnLoad"]: ci = IndexesHolder().getById('collaboration') tz = self._rh._getUser().getTimezone() ##### minKey = None maxKey = None if self._queryParams['sinceDate']: minKey = setAdjustedDate(parseDateTime(self._queryParams['sinceDate'].strip()), tz = self._tz) if self._queryParams['toDate']: maxKey = setAdjustedDate(parseDateTime(self._queryParams['toDate'].strip()), tz = self._tz) if self._queryParams['fromTitle']: minKey = self._queryParams['fromTitle'].strip() if self._queryParams['toTitle']: maxKey = self._queryParams['toTitle'].strip() if self._queryParams['fromDays']: try: fromDays = int(self._queryParams['fromDays']) except ValueError, e: raise CollaborationException(_("Parameter 'fromDays' is not an integer"), inner = e) minKey = nowutc() - timedelta(days = fromDays) if self._queryParams['toDays']: try: toDays = int(self._queryParams['toDays']) except ValueError, e: raise CollaborationException(_("Parameter 'toDays' is not an integer"), inner = e) maxKey = nowutc() + timedelta(days = toDays)
def _checkParams(self): CollaborationBase._checkParams(self) if self._params.has_key('plugin'): self._plugin = self._params['plugin'] else: raise CollaborationException( _("Plugin name not set when trying to add or remove a manager on event: " ) + str(self._conf.getId()) + _(" with the service ") + str(self.__class__)) if CollaborationTools.getCollaborationPluginType().hasPlugin( self._plugin) and CollaborationTools.isAdminOnlyPlugin( self._plugin): raise CollaborationException( _("Tried to add or remove a manager for an admin-only plugin on event : " ) + str(self._conf.getId()) + _(" with the service ") + str(self.__class__))
def _checkParams(self): CollaborationBookingModifBase._checkParams(self) if self._params.has_key('bookingParams'): pm = ParameterManager(self._params) self._bookingParams = pm.extract("bookingParams", pType=dict, allowEmpty = True) else: raise CollaborationException(_("Custom parameters for booking ") + str(self._bookingId) + _(" not set when trying to edit a booking on meeting ") + str(self._conf.getId() ))
def call(self): allowedPlugins = {"conference": [], "meeting": [], "simple_event": []} for plugin in self._pluginType.getPluginList(includeNonActive = True): allowedOn = CollaborationTools.getPluginAllowedOn(plugin) for eventType in allowedOn: try: allowedPlugins[eventType].append(plugin) except KeyError,e: raise CollaborationException("Allowed kinds of events: conference, meeting, simple_event. %s is not allowed" % str(eventType), inner = e)
def _checkParams(self): CollaborationPluginServiceBase._checkParams(self) bookingId = self._params.get("booking", None) if bookingId: self._booking = self._CSBookingManager.getBooking(bookingId) else: raise CollaborationException( _("Service " + str(self.__class__.__name__) + _(" was called without a 'booking' parameter ")))
def _checkParams(self): CollaborationBase._checkParams(self) if self._params.has_key('bookingId'): self._bookingId = self._params['bookingId'] booking = self._CSBookingManager.getBooking(self._bookingId) self._bookingType = booking.getType() self._bookingPlugin = booking.getPlugin() else: raise CollaborationException(_("Booking id not set when trying to modify a booking on meeting ") + str(self._conf.getId()) + _(" with the service ") + str(self.__class__) )
def _checkCanManagePlugin(self, plugin): isAdminOnlyPlugin = CollaborationTools.isAdminOnlyPlugin(plugin) hasAdminRights = RCCollaborationAdmin.hasRights(self) or \ RCCollaborationPluginAdmin.hasRights(self, None, [plugin]) if not hasAdminRights and isAdminOnlyPlugin: raise CollaborationException( _("Cannot acces service of admin-only plugin if user is not admin, for event: " ) + str(self._conf.getId()) + _(" with the service ") + str(self.__class__)) elif not hasAdminRights and not RCVideoServicesManager.hasRights( self, [plugin]): #we check if it's an event creator / manager (this will call ConferenceModifBase._checkProtection) CollaborationBase._checkProtection(self)
def _checkParams(self): CollaborationBase._checkParams(self) if self._params.has_key('bookingId'): self._bookingId = self._params['bookingId'] self._booking = self._CSBookingManager.getBooking(self._bookingId) if self._booking == None: raise NoReportError( _("The booking that you are trying to modify does not exist. Maybe it was already deleted, please refresh the page." )) self._bookingType = self._booking.getType() self._bookingPlugin = self._booking.getPlugin() self._pm = ParameterManager(self._params) else: raise CollaborationException( _("Booking id not set when trying to modify a booking on meeting " ) + str(self._conf.getId()) + _(" with the service ") + str(self.__class__))
def _getAnswer(self): raise CollaborationException("No answer was returned")
def _checkParams(self): AdminCollaborationBase._checkParams(self) user = self.getAW().getUser() pm = ParameterManager(self._params) if user: #someone is logged in. if not, AdminCollaborationBase's _checkProtection will take care of it self._tz = user.getTimezone() try: self._page = self._params.get("page", None) self._resultsPerPage = self._params.get("resultsPerPage", None) self._indexName = self._params['indexName'] self._viewBy = self._params['viewBy'] self._orderBy = self._params['orderBy'] if self._indexName in [ 'RecordingRequest', 'WebcastRequest', 'All Requests' ] and self._viewBy == 'startDate': self._viewBy = 'instanceDate' minKey = None maxKey = None if self._params['sinceDate']: minKey = timezone(self._tz).localize( datetime.combine( pm.extract("sinceDate", pType=date, allowEmpty=True), time(0, 0))) if self._params['toDate']: maxKey = timezone(self._tz).localize( datetime.combine( pm.extract("toDate", pType=date, allowEmpty=True), time(23, 59, 59))) if self._params['fromTitle']: minKey = self._params['fromTitle'].strip() if self._params['toTitle']: maxKey = self._params['toTitle'].strip() """ For relative dates, create a diff timedelta for resetting to 00:00 at the start of range and 23:59 at the end. """ if self._params['fromDays']: try: fromDays = int(self._params['fromDays']) except ValueError, e: raise CollaborationException( _("Parameter 'fromDays' is not an integer"), inner=e) midnight = nowutc().replace(hour=0, minute=0, second=0) minKey = midnight - timedelta(days=fromDays) if self._params['toDays']: try: toDays = int(self._params['toDays']) except ValueError, e: raise CollaborationException( _("Parameter 'toDays' is not an integer"), inner=e) midnight_1 = nowutc().replace(hour=23, minute=59, second=59) maxKey = midnight_1 + timedelta(days=toDays) self._minKey = minKey self._maxKey = maxKey self._onlyPending = self._params['onlyPending'] categoryId = self._params['categoryId'].strip() if categoryId: self._categoryId = categoryId else: self._categoryId = None conferenceId = self._params['conferenceId'].strip() if conferenceId: self._conferenceId = conferenceId else: self._conferenceId = None
def _checkProtection(self): CollaborationBookingModifBase._checkProtection(self) if not RCVideoServicesUser.hasRights(self, None, self._bookingType): raise CollaborationException( _("You dot have access to modify a %s booking") % self._bookingType)
def modifyRoom(cls, booking, oldBookingParams): # we extract the different parameters # We set the original conference id because the bookings can belong to more than one conference and being cloned # and it is used for the long name, we need to keep always the same confId confId = booking.getConference().getId() bookingId = booking.getId() roomId = booking.getRoomId() roomName = booking.getBookingParamByName("roomName") description = booking.getBookingParamByName("roomDescription") newOwner = booking.getOwnerObject() #an avatar object ownerAccountName = booking.getOwnerAccount() #a str oldOwner = oldBookingParams["owner"] #an IAvatarFossil fossil pin = booking.getPin() moderatorPin = booking.getModeratorPin() #we obtain the unicode object with the proper format for the room name roomNameForVidyo = VidyoTools.roomNameForVidyo(roomName) if isinstance(roomNameForVidyo, VidyoError): return roomNameForVidyo #we turn the description into a unicode object description = VidyoTools.descriptionForVidyo(description) if isinstance(description, VidyoError): return description #(the extension will not change) #we check if the owner has changed. If not, we reuse the same accountName useOldAccountName = True possibleLogins = [] if newOwner.getId() != oldOwner["id"]: useOldAccountName = False #we produce the list of possible account names. We will loop through them to attempt to create the room possibleLogins = VidyoTools.getAvatarLoginList(newOwner) if not possibleLogins: raise CollaborationException( _("The moderator has no login information")) # We check the moderator PIN is a 3-10 digit number if moderatorPin and (not moderatorPin.isdigit() or len(moderatorPin) < 3 or len(moderatorPin) > 10): return VidyoError("PINLength", "modify") roomModified = False loginToUse = 0 while not roomModified and (useOldAccountName or loginToUse < len(possibleLogins)): if not useOldAccountName: ownerAccountName = possibleLogins[loginToUse] newRoom = SOAPObjectFactory.createRoom(roomNameForVidyo, description, ownerAccountName, booking.getExtension(), pin, moderatorPin) try: AdminApi.updateRoom(roomId, newRoom) roomModified = True except WebFault, e: faultString = e.fault.faultstring if faultString.startswith('Room not exist for roomID'): return VidyoError("unknownRoom", "modify") elif faultString.startswith('Room exist for name'): return VidyoError("duplicated", "modify") elif faultString.startswith('Member not found for ownerName'): if useOldAccountName: #maybe the user was deleted between the time the room was created and now return VidyoError("badOwner", "modify") else: loginToUse = loginToUse + 1 elif faultString.startswith( 'PIN should be a 3-10 digit number'): return VidyoError("PINLength", "modify") else: Logger.get('Vidyo').exception( """Evt:%s, booking:%s, Admin API's updateRoom operation got WebFault: %s""" % (confId, bookingId, e.fault.faultstring)) raise
def _checkParams(self): CollaborationBase._checkParams(self) if self._params.has_key('plugin'): self._plugin = self._params['plugin'] else: raise CollaborationException(_("Plugin name not set when trying to add a manager on event: ") + str(self._conf.getId()) + _(" with the service ") + str(self.__class__) )