def _setMailText(self): text = self.text if self.note: text = text + "Note: %s" % self.note if self.confSumary: #try: from MaKaC.common.output import outputGenerator from MaKaC.accessControl import AdminList, AccessWrapper import MaKaC.webinterface.urlHandlers as urlHandlers admin = AdminList().getInstance().getList()[0] aw = AccessWrapper() aw.setUser(admin) path = Config.getInstance().getStylesheetsDir() if os.path.exists("%s/text.xsl" % path): stylepath = "%s/text.xsl" % path outGen = outputGenerator(aw) vars = { \ "modifyURL": urlHandlers.UHConferenceModification.getURL( self.conf ), \ "sessionModifyURLGen": urlHandlers.UHSessionModification.getURL, \ "contribModifyURLGen": urlHandlers.UHContributionModification.getURL, \ "subContribModifyURLGen": urlHandlers.UHSubContribModification.getURL, \ "materialURLGen": urlHandlers.UHMaterialDisplay.getURL, \ "resourceURLGen": urlHandlers.UHFileAccess.getURL } confText = outGen.getOutput(self.conf, stylepath, vars) text += "\n\n\n" + confText #except: # text += "\n\n\nSorry could not embed text version of the agenda..." self.mail.setText(text)
def rb_check_user_access(user): """ Check if user should have access to RB module in general """ authorized = PluginsHolder().getPluginType("RoomBooking").getOption("AuthorisedUsersGroups").getValue() if AdminList.getInstance().isAdmin(user): # user is admin return True elif len(authorized) == 0: # the authorization list is empty (it's disabled) return True else: # there is something in the authorization list for entity in authorized: if ( isinstance(entity, user_mod.Group) and entity.containsUser(user) or isinstance(entity, user_mod.Avatar) and entity == user ): return True return False
def _checkSessionUser(self): user = self._getUser() if user == None: self._redirect(self._getLoginURL()) self._doProcess = False else: try: if PluginsHolder().getPluginType("RoomBooking").isActive(): if ( not AdminList.getInstance().isAdmin(user) and PluginsHolder().getPluginType("RoomBooking").getOption("AuthorisedUsersGroups").getValue() != [] ): authenticatedUser = False for entity in ( PluginsHolder().getPluginType("RoomBooking").getOption("AuthorisedUsersGroups").getValue() ): if ( isinstance(entity, Group) and entity.containsUser(user) or isinstance(entity, Avatar) and entity == user ): authenticatedUser = True break if not authenticatedUser: raise AccessError() except KeyError: pass
def _getAnswer(self): sm = SyncManager.getDBInstance() avtypes = AgentTypeInspector.getAvailableTypes() if self._type not in avtypes: raise ServiceError('', 'Agent type %s is unknown' % self._type) typeClass = avtypes[self._type] access = AdminList().getInstance().getList()[0] sm.registerNewAgent( typeClass(self._id, self._name, self._description, 60, access, **self._specificParams))
def rb_check_user_access(user): """ Check if user should have access to RB module in general """ authorized = PluginsHolder().getPluginType("RoomBooking").getOption( "AuthorisedUsersGroups").getValue() if AdminList.getInstance().isAdmin(user): # user is admin return True elif len(authorized) == 0: # the authorization list is empty (it's disabled) return True else: # there is something in the authorization list for entity in authorized: if isinstance(entity, user_mod.Group) and entity.containsUser(user) or \ isinstance(entity, user_mod.Avatar) and entity == user: return True return False
def _checkSessionUser(self): user = self._getUser() if user == None: self._redirect(self._getLoginURL()) self._doProcess = False else: try: if PluginsHolder().getPluginType("RoomBooking").isActive(): if not AdminList.getInstance().isAdmin( user) and PluginsHolder().getPluginType( "RoomBooking").getOption( "AuthorisedUsersGroups").getValue() != []: authenticatedUser = False for entity in PluginsHolder().getPluginType( "RoomBooking").getOption( "AuthorisedUsersGroups").getValue(): if isinstance(entity, Group) and entity.containsUser(user) or \ isinstance(entity, Avatar) and entity == user: authenticatedUser = True break if not authenticatedUser: raise AccessError() except KeyError: pass
def getAdminList(self): from MaKaC.accessControl import AdminList return AdminList.getInstance()
def _checkProtection( self ): al = AdminList.getInstance() if not (self._aw.getUser() in al.getList()): raise errors.AccessError("user status")
def getAdminList( self ): from MaKaC.accessControl import AdminList return AdminList.getInstance()
def _checkProtection(self): al = AdminList.getInstance() if not (self._aw.getUser() in al.getList()): raise errors.AccessError("user status")