示例#1
0
    def canBook(self, user):
        """
        FINAL (not intented to be overriden)
        Reservable rooms which does not require pre-booking can be booked by anyone.
        Other rooms - only by their responsibles.
        """

        # if the user has no access to the RB module, let's end it here
        if not rb_check_user_access(user):
            return False

        if self.isActive and self.isReservable and not self.resvsNeedConfirmation:
            simbaList = self.customAtts.get('Booking Simba List')
            if simbaList and simbaList != "Error: unknown mailing list" and simbaList != "":
                if user.isMemberOfSimbaList(simbaList):
                    return True
            else:
                return True
        if user == None:
            return False

        if (self.isOwnedBy( user ) and self.isActive) \
                or user.isRBAdmin():
            return True
        return False
示例#2
0
    def canBook(self, user):
        """
        FINAL (not intented to be overriden)
        Reservable rooms which does not require pre-booking can be booked by anyone.
        Other rooms - only by their responsibles.
        """

        # if the user has no access to the RB module, let's end it here
        if not rb_check_user_access(user):
            return False

        if self.isActive and self.isReservable and not self.resvsNeedConfirmation:
            simbaList = self.customAtts.get('Booking Simba List')
            if simbaList and simbaList != "Error: unknown mailing list" and simbaList != "":
                if user.isMemberOfSimbaList(simbaList):
                    return True
            else:
                return True
        if user == None:
            return False

        if (self.isOwnedBy( user ) and self.isActive) \
                or user.isRBAdmin():
            return True
        return False
示例#3
0
文件: base.py 项目: vstitches/indico
 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 rb_check_user_access(user):
                     raise AccessError()
         except KeyError:
             pass
示例#4
0
 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 rb_check_user_access(user):
                     raise AccessError()
         except KeyError:
             pass
示例#5
0
文件: base.py 项目: Ictp/indico
 def _checkSessionUser(self):
     user = self._getUser()
     if user is None:
         if request.headers.get("Content-Type", "text/html").find("application/json") != -1:
             raise NotLoggedError("You are currently not authenticated. Please log in again.")
         else:
             self._redirect(self._getLoginURL())
             self._doProcess = False
     else:
         try:
             if PluginsHolder().getPluginType("RoomBooking").isActive():
                 if not rb_check_user_access(user):
                     raise AccessError()
         except KeyError:
             pass
示例#6
0
 def _hasAccess(self, aw):
     """
     Check if the user may access the RB module
     """
     return rb_check_user_access(aw.getUser())