def getOptionValue(cls, pluginName, optionName): """ Returns the value of an option of a plugin (plugins/Collaboration/XXXXX/options.py) pluginName: a string with the name of the plugin optionName: a string with the name of the option """ ph = PluginsHolder() return ph.getPluginType("Collaboration").getPlugin(pluginName).getOption(optionName).getValue()
def getOptionValue(cls, pluginName, optionName): """ Returns the value of an option of a plugin (plugins/Collaboration/XXXXX/options.py) pluginName: a string with the name of the plugin optionName: a string with the name of the option """ ph = PluginsHolder() return ph.getPluginType("Collaboration").getPlugin(pluginName).getOption(optionName).getValue()
def updatePluginSettingsNewRB(dbi, prevVersion): """Migrate plugin settings to be compatible with the new RB module""" ph = PluginsHolder() # Custom attributes are now loercase-with-dashes internally opt = ph.getPluginType('Collaboration').getPlugin('CERNMCU').getOption('H323_IP_att_name') if opt.getValue() == 'H323 IP': opt.setValue('h323-ip') # Replace room GUIDs with plain room IDs for plugin_name, rooms_opt in [('WebcastRequest', 'webcastCapableRooms'), ('RecordingRequest', 'recordingCapableRooms')]: opt = ph.getPluginType('Collaboration').getPlugin(plugin_name).getOption(rooms_opt) room_ids = [] for room_id in opt.getValue(): if isinstance(room_id, basestring): room_id = int(room_id.split('|')[1].strip()) if Room.get(room_id): room_ids.append(room_id) opt.setValue(room_ids) dbi.commit()
def _process( self ): if self._conf.isClosed(): p = conferences.WPConferenceModificationClosed( self, self._target ) return p.display() else: ph = PluginsHolder() if ph.getPluginType('Collaboration').getOption("useHTTPS").getValue(): self._tohttps = True if self._checkHttpsRedirect(): return "" p = collaboration.WPConfModifCollaboration( self, self._conf) return p.display()
def _process(self): if self._conf.isClosed(): p = conferences.WPConferenceModificationClosed(self, self._target) return p.display() else: ph = PluginsHolder() if ph.getPluginType('Collaboration').getOption( "useHTTPS").getValue(): self._tohttps = True if self._checkHttpsRedirect(): return "" p = collaboration.WPConfModifCollaboration(self, self._conf) return p.display()
def _checkParams(self): optionName = self._params.get('optionName', None) if optionName: options = optionName.split('.') ph = PluginsHolder() if len(options) == 3: pluginType, plugin, option = options if ph.hasPluginType(pluginType): if ph.getPluginType(pluginType).hasPlugin(plugin): self._targetOption = ph.getPluginType(pluginType).getPlugin(plugin).getOption(option) else: raise ServiceError('ERR-PLUG4', 'plugin: ' + str(plugin) + ' does not exist') else: raise ServiceError('ERR-PLUG3', 'pluginType: ' + str(pluginType) + ' does not exist, is not visible or not active') elif len(options) == 2: pluginType, option = options if ph.hasPluginType(pluginType): self._targetOption = ph.getPluginType(pluginType).getOption(option) else: raise ServiceError('ERR-PLUG3', 'pluginType: ' + str(pluginType) + ' does not exist, is not visible or not active') else: raise ServiceError('ERR-PLUG1', 'optionName argument does not have the proper pluginType.plugin.option format') else: raise ServiceError('ERR-PLUG0', 'optionName argument not present')
class RHAdminPluginsBase(RHAdminBase): """ Base RH class for all plugin management requests. It will store 2 string parameters: pluginType and pluginId. Example: pluginType = "COllaboration" & pluginId = "EVO" """ def _checkParams(self, params): RHAdminBase._checkParams(self, params) self._pluginType = params.get("pluginType", None) self._pluginId = params.get("pluginId", None) self._ph = PluginsHolder() if self._pluginType and not self._ph.hasPluginType(self._pluginType, mustBeActive = False): raise PluginError("The plugin type " + self._pluginType + " does not exist or is not visible") elif self._pluginType and self._pluginId and not self._ph.getPluginType(self._pluginType).hasPlugin(self._pluginId): raise PluginError("The plugin " + self._pluginId + " does not exist")
def changeVidyoRoomNames(dbi, withRBDB, prevVersion): """ Changing Vidyo Room Names """ ph = PluginsHolder() collaboration_pt = ph.getPluginType("Collaboration") if not collaboration_pt.isActive() or not collaboration_pt.getPlugin("Vidyo").isActive(): return i = 0 for booking in VidyoTools.getIndexByVidyoRoom().itervalues(): if hasattr(booking, '_originalConferenceId'): roomName = booking.getBookingParamByName("roomName") + '_indico_' + booking._originalConferenceId booking._bookingParams["roomName"] = roomName.decode("utf-8") del booking._originalConferenceId i += 1 if i % 10000 == 0: dbi.commit() dbi.commit()
def pluginOptionsRoomGUIDs(dbi, withRBDB, prevVersion): """ Modifying Room GUIDs """ if not withRBDB: return ph = PluginsHolder() for pluginName, roomsOpt in [('WebcastRequest', 'webcastCapableRooms'), ('RecordingRequest', 'recordingCapableRooms')]: opt = ph.getPluginType('Collaboration').getPlugin(pluginName).getOption(roomsOpt) newValue = [] for name in opt.getValue(): loc, name = name.split(':') room = CrossLocationQueries.getRooms(location=loc, roomName=name) if room: newValue.append(str(room.guid)) opt.setValue(newValue)
class RHAdminPluginsBase(RHAdminBase): """ Base RH class for all plugin management requests. It will store 2 string parameters: pluginType and pluginId. Example: pluginType = "COllaboration" & pluginId = "EVO" """ def _checkParams(self, params): RHAdminBase._checkParams(self, params) self._pluginType = params.get("pluginType", None) self._pluginId = params.get("pluginId", None) self._ph = PluginsHolder() if self._pluginType and not self._ph.hasPluginType(self._pluginType, mustBeActive=False): raise PluginError("The plugin type " + self._pluginType + " does not exist or is not visible") elif self._pluginType and self._pluginId and not self._ph.getPluginType( self._pluginType).hasPlugin(self._pluginId): raise PluginError("The plugin " + self._pluginId + " does not exist")
def changeVidyoRoomNames(dbi, withRBDB, prevVersion): """ Changing Vidyo Room Names """ ph = PluginsHolder() collaboration_pt = ph.getPluginType("Collaboration") if not collaboration_pt.isActive() or not collaboration_pt.getPlugin("Vidyo").isActive(): return i = 0 for booking in VidyoTools.getIndexByVidyoRoom().itervalues(): if hasattr(booking, '_originalConferenceId'): roomName = booking.getBookingParamByName("roomName") + '_indico_' + booking._originalConferenceId booking._bookingParams["roomName"] = roomName.decode("utf-8") del booking._originalConferenceId i += 1 if i % 10000 == 0: dbi.commit() dbi.commit()
def pluginOptionsRoomGUIDs(dbi, withRBDB, prevVersion): """ Modifying Room GUIDs """ if not withRBDB: return ph = PluginsHolder() for pluginName, roomsOpt in [('WebcastRequest', 'webcastCapableRooms'), ('RecordingRequest', 'recordingCapableRooms')]: opt = ph.getPluginType('Collaboration').getPlugin(pluginName).getOption(roomsOpt) newValue = [] for name in opt.getValue(): loc, name = name.split(':') room = CrossLocationQueries.getRooms(location=loc, roomName=name) if room: newValue.append(str(room.guid)) opt.setValue(newValue)
def conferenceMigration1_0(dbi, withRBDB, prevVersion): """ Tasks: 1. Moving support info fields from conference to a dedicated class 2. Update non inherited children list 3. Update Vidyo indexes """ def _updateMaterial(obj): for material in obj.getAllMaterialList(sort=False): material.getAccessController().setNonInheritingChildren(set()) if material.getAccessController().getAccessProtectionLevel() != 0: material.notify_protection_to_owner(material) for resource in material.getResourceList(sort=False): if resource.getAccessController().getAccessProtectionLevel() != 0: resource.notify_protection_to_owner() def updateSupport(conf): ################################################################# #Moving support info fields from conference to a dedicated class: ################################################################# dMgr = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(conf) caption = email = telephone = "" if hasattr(dMgr, "_supportEmailCaption"): caption = dMgr._supportEmailCaption del dMgr._supportEmailCaption if hasattr(conf, "_supportEmail"): email = conf._supportEmail del conf._supportEmail supportInfo = SupportInfo(conf, caption, email, telephone) conf.setSupportInfo(supportInfo) def updateNonInheritedChildren (conf): #################################### #Update non inherited children list: #################################### conf.getAccessController().setNonInheritingChildren(set()) _updateMaterial(conf) for session in conf.getSessionList(): session.getAccessController().setNonInheritingChildren(set()) if session.getAccessController().getAccessProtectionLevel() != 0: session.notify_protection_to_owner(session) _updateMaterial(session) for contrib in conf.getContributionList(): contrib.getAccessController().setNonInheritingChildren(set()) if contrib.getAccessController().getAccessProtectionLevel() != 0: contrib.notify_protection_to_owner(contrib) _updateMaterial(contrib) for subContrib in contrib.getSubContributionList(): _updateMaterial(subContrib) def updateVidyoIndex(conf, endDateIndex, vidyoRoomIndex): #################################### #Update vidyo indexes: #################################### csbm = getattr(conf, "_CSBookingManager", None) if csbm is None: return for booking in csbm.getBookingList(): if booking.getType() == "Vidyo" and booking.isCreated(): endDateIndex.indexBooking(booking) vidyoRoomIndex.indexBooking(booking) ph = PluginsHolder() collaboration_pt = ph.getPluginType("Collaboration") vidyoPluginActive = collaboration_pt.isActive() and collaboration_pt.getPlugin("Vidyo").isActive() if vidyoPluginActive: endDateIndex = VidyoTools.getEventEndDateIndex() vidyoRoomIndex = VidyoTools.getIndexByVidyoRoom() endDateIndex.clear() vidyoRoomIndex.clear() ch = ConferenceHolder() i = 0 for (__, conf) in console.conferenceHolderIterator(ch, deepness='event'): updateSupport(conf) updateNonInheritedChildren(conf) if vidyoPluginActive: updateVidyoIndex(conf, endDateIndex, vidyoRoomIndex) if i % 10000 == 9999: dbi.commit() i += 1 dbi.commit()
def conferenceMigration1_0(dbi, withRBDB, prevVersion): """ Tasks: 1. Moving support info fields from conference to a dedicated class 2. Update non inherited children list 3. Update Vidyo indexes """ def _updateMaterial(obj): for material in obj.getAllMaterialList(sort=False): material.getAccessController().setNonInheritingChildren(set()) if material.getAccessController().getAccessProtectionLevel() != 0: material.notify_protection_to_owner(material) for resource in material.getResourceList(sort=False): if resource.getAccessController().getAccessProtectionLevel() != 0: resource.notify_protection_to_owner() def updateSupport(conf): ################################################################# #Moving support info fields from conference to a dedicated class: ################################################################# dMgr = displayMgr.ConfDisplayMgrRegistery().getDisplayMgr(conf) caption = email = telephone = "" if hasattr(dMgr, "_supportEmailCaption"): caption = dMgr._supportEmailCaption del dMgr._supportEmailCaption if hasattr(conf, "_supportEmail"): email = conf._supportEmail del conf._supportEmail supportInfo = SupportInfo(conf, caption, email, telephone) conf.setSupportInfo(supportInfo) def updateNonInheritedChildren (conf): #################################### #Update non inherited children list: #################################### conf.getAccessController().setNonInheritingChildren(set()) _updateMaterial(conf) for session in conf.getSessionList(): session.getAccessController().setNonInheritingChildren(set()) if session.getAccessController().getAccessProtectionLevel() != 0: session.notify_protection_to_owner(session) _updateMaterial(session) for contrib in conf.getContributionList(): contrib.getAccessController().setNonInheritingChildren(set()) if contrib.getAccessController().getAccessProtectionLevel() != 0: contrib.notify_protection_to_owner(contrib) _updateMaterial(contrib) for subContrib in contrib.getSubContributionList(): _updateMaterial(subContrib) def updateVidyoIndex(conf, endDateIndex, vidyoRoomIndex, pluginActive): ###################### #Update Vidyo indexes: ###################### if not pluginActive: return csbm = conf.getCSBookingManager() for booking in csbm.getBookingList(): if booking.getType() == "Vidyo" and booking.isCreated(): endDateIndex.indexBooking(booking) vidyoRoomIndex.indexBooking(booking) endDateIndex = VidyoTools.getEventEndDateIndex() vidyoRoomIndex = VidyoTools.getIndexByVidyoRoom() endDateIndex.clear() vidyoRoomIndex.clear() ph = PluginsHolder() collaboration_pt = ph.getPluginType("Collaboration") pluginActive = collaboration_pt.isActive() and collaboration_pt.getPlugin("Vidyo").isActive() ch = ConferenceHolder() i = 0 for (__, conf) in console.conferenceHolderIterator(ch, deepness='event'): updateSupport(conf) updateNonInheritedChildren(conf) updateVidyoIndex(conf, endDateIndex, vidyoRoomIndex, pluginActive) if i % 10000 == 9999: dbi.commit() i += 1 dbi.commit()