def hasRights(user, plugins=[]): """ Returns True if the user is an admin of one of the plugins corresponding to pluginNames plugins: a list of Plugin objects (e.g. EVO, RecordingRequest) or strings with the plugin name ('EVO', 'RecordingRequest') or the string 'any' (we will then check if the user is manager of any plugin), """ if user: plist = CollaborationTools.getCollaborationPluginType().getPluginList() if plugins == 'any' else plugins if plist: for plugin in plist: if not isinstance(plugin, Plugin): plugin = CollaborationTools.getPlugin(plugin) if user in plugin.getOption('admins').getValue(): return True return False
def setup(cls): # lazy import because we don't want it to be imported by default # (as the plugin system currently loads all submodules) from indico.tests.config import TestConfig PluginsHolder().loadAllPlugins() testConfig = TestConfig.getInstance() vidyoOptions = CollaborationTools.getPlugin("Vidyo").getOptions() vidyoOptions["indicoUsername"].setValue(testConfig.getCollaborationOptions()["Vidyo"]["indicoUsername"]) vidyoOptions["indicoPassword"].setValue(testConfig.getCollaborationOptions()["Vidyo"]["indicoPassword"]) cls._setupDone = True
def hasRights(user, plugins=[]): """ Returns True if the user is an admin of one of the plugins corresponding to pluginNames plugins: a list of Plugin objects (e.g. EVO, RecordingRequest) or strings with the plugin name ('EVO', 'RecordingRequest') or the string 'any' (we will then check if the user is manager of any plugin), """ if user: plist = CollaborationTools.getCollaborationPluginType( ).getPluginList() if plugins == 'any' else plugins if plist: for plugin in plist: if not isinstance(plugin, Plugin): plugin = CollaborationTools.getPlugin(plugin) if user in plugin.getOption('admins').getValue(): return True return False
def hasRights(user, pluginName=""): """ Returns True if the logged in user is an authorised user to create bookings. This is true if: - The user is in the list of authorised user and groups request: the user pluginName: the plugin to check """ if user: plugin = CollaborationTools.getPlugin(pluginName) if plugin.hasOption("AuthorisedUsersGroups"): if plugin.getOption("AuthorisedUsersGroups").getValue(): for entity in plugin.getOption("AuthorisedUsersGroups").getValue(): if isinstance(entity, Group) and entity.containsUser(user) or \ isinstance(entity, Avatar) and entity == user: return True return False else: return True else: return True return False
def hasRights(user, pluginName=""): """ Returns True if the logged in user is an authorised user to create bookings. This is true if: - The user is in the list of authorised user and groups request: the user pluginName: the plugin to check """ if user: plugin = CollaborationTools.getPlugin(pluginName) if plugin.hasOption("AuthorisedUsersGroups"): if plugin.getOption("AuthorisedUsersGroups").getValue(): for entity in plugin.getOption( "AuthorisedUsersGroups").getValue(): if isinstance(entity, Group) and entity.containsUser(user) or \ isinstance(entity, Avatar) and entity == user: return True return False else: return True else: return True return False
def setUp(self): super(TestVidyoPluginOptions, self).setUp() with self._context('database'): self.plugin = CollaborationTools.getPlugin("Vidyo")
def setUp(self): super(TestVidyoPluginOptions, self).setUp() with self._context('database'): self.plugin = CollaborationTools.getPlugin("Vidyo")