Exemplo n.º 1
0
    def isPluginManager(self, obj, params):
        """ Returns True if the logged in user has rights to operate with bookings of at least one of a list of plugins, for an event.
            This is true if:
                -the user is a Video Services manager (can operate with all plugins)
                -the user is a plugin manager of one of the plugins
        """

        return RCVideoServicesManager.hasRights(params.get("user", None), params.get("conf", None), params.get("plugins", []))
Exemplo n.º 2
0
    def isPluginManager(self, obj, params):
        """ Returns True if the logged in user has rights to operate with bookings of at least one of a list of plugins, for an event.
            This is true if:
                -the user is a Video Services manager (can operate with all plugins)
                -the user is a plugin manager of one of the plugins
        """

        return RCVideoServicesManager.hasRights(params.get("user", None), params.get("conf", None), params.get("plugins", []))
Exemplo n.º 3
0
    def _checkCanManagePlugin(self, plugin):
        isAdminOnlyPlugin = CollaborationTools.isAdminOnlyPlugin(plugin)

        hasAdminRights = RCCollaborationAdmin.hasRights(self._getUser()) or RCCollaborationPluginAdmin.hasRights(self._getUser(), [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._getUser(), self._conf, [plugin]):
            #we check if it's an event creator / manager (this will call ConferenceModifBase._checkProtection)
            ConferenceModifBase._checkProtection(self)
Exemplo n.º 4
0
    def _search(cls, user, query, offset=0, limit=None):

        if not query.strip():
            return [], None

        ask_for_more = True
        allowed_rooms = []

        while ask_for_more:
            result = VidyoOperations.searchRooms(query,
                                                 offset=offset,
                                                 limit=limit)

            if isinstance(result, VidyoError):
                # query held no results? there's nothing left.
                return result, offset

            if not result:
                # set offset to None, meaning that the bottom of the "search stream" has been reached
                offset = None
                break

            for room in result:
                av = VidyoTools.getAvatarByAccountName(room.ownerName)

                # go through all bookings that use this room and check if this user has any privileges
                # over them
                for booking in VidyoTools.getIndexByVidyoRoom().getBookingList(
                        room.roomID):
                    if av == user or booking.getConference() in user.getLinkTo("conference", "manager") \
                            or user == booking.getConference().getCreator() \
                            or RCVideoServicesManager.hasRights(user, booking.getConference(), ["Vidyo"]) \
                            or user.isAdmin():

                        # if that's the case, add the booking to our list
                        bookingParams = booking.getBookingParams().copy()
                        bookingParams["videoLinkType"] = "event"
                        bookingParams["videoLinkSession"] = ""
                        bookingParams["videoLinkContribution"] = ""
                        allowed_rooms.append(bookingParams)
                        break

                offset += 1

                if limit is not None and len(allowed_rooms) >= limit:
                    # reached limit? that's enough!
                    ask_for_more = False
                    break

        return (allowed_rooms, offset)
Exemplo n.º 5
0
    def _search(cls, user, query, offset=0, limit=None):

        if not query.strip():
            return [], None

        ask_for_more = True
        allowed_rooms = []

        while ask_for_more:
            result = VidyoOperations.searchRooms(query, offset=offset, limit=limit)

            if isinstance(result, VidyoError):
                # query held no results? there's nothing left.
                return result, offset

            if not result:
                # set offset to None, meaning that the bottom of the "search stream" has been reached
                offset = None
                break

            for room in result:
                av = VidyoTools.getAvatarByAccountName(room.ownerName)

                # go through all bookings that use this room and check if this user has any privileges
                # over them
                for booking in VidyoTools.getIndexByVidyoRoom().getBookingList(room.roomID):
                    if av == user or booking.getConference() in user.getLinkTo("conference", "manager") \
                            or user == booking.getConference().getCreator() \
                            or RCVideoServicesManager.hasRights(user, booking.getConference(), ["Vidyo"]) \
                            or user.isAdmin():

                        # if that's the case, add the booking to our list
                        bookingParams = booking.getBookingParams().copy()
                        bookingParams["videoLinkType"] = "event"
                        bookingParams["videoLinkSession"] = ""
                        bookingParams["videoLinkContribution"] = ""
                        allowed_rooms.append(bookingParams)
                        break

                offset += 1

                if limit is not None and len(allowed_rooms) >= limit:
                    # reached limit? that's enough!
                    ask_for_more = False
                    break

        return (allowed_rooms, offset)
Exemplo n.º 6
0
    def _checkCanManagePlugin(self, plugin):
        isAdminOnlyPlugin = CollaborationTools.isAdminOnlyPlugin(plugin)

        hasAdminRights = RCCollaborationAdmin.hasRights(
            self._getUser()) or RCCollaborationPluginAdmin.hasRights(
                self._getUser(), [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._getUser(), self._conf, [plugin]):
            #we check if it's an event creator / manager (this will call ConferenceModifBase._checkProtection)
            ConferenceModifBase._checkProtection(self)
Exemplo n.º 7
0
    def _search(cls, user, query, offset=0, limit=None):
        if query == "":
            return[]
        result = VidyoOperations.searchRooms(query)
        if isinstance(result, VidyoError):
            return result

        allowedRooms = []
        for room in result:
            av = VidyoTools.getAvatarByAccountName(room.ownerName)
            for booking in VidyoTools.getIndexByVidyoRoom().getBookingList(room.roomID):
                if av == user or booking.getConference() in user.getLinkTo("conference", "manager") \
                        or user == booking.getConference().getCreator() \
                        or RCVideoServicesManager.hasRights(user, booking.getConference(), ["Vidyo"]):
                    bookingParams = booking.getBookingParams().copy()
                    bookingParams["videoLinkType"] = "event"
                    bookingParams["videoLinkSession"] = ""
                    bookingParams["videoLinkContribution"] = ""
                    allowedRooms.append(bookingParams)
                    break
        limit = limit if limit else (len(allowedRooms) - 1)
        return allowedRooms[offset:offset+limit]
Exemplo n.º 8
0
 def _checkProtection(self):
     if not RCVideoServicesManager.hasRights(self._getUser(), self._conf):
         CollaborationBase._checkProtection(self)
Exemplo n.º 9
0
 def fillManagementSideMenu(cls, obj, params={}):
     csbm = Catalog.getIdx("cs_bookingmanager_conference").get(obj._conf.getConference().getId())
     if csbm is not None and csbm.isCSAllowed(obj._rh.getAW().getUser()) and \
         (obj._conf.canModify(obj._rh.getAW()) or RCVideoServicesManager.hasRights(obj._rh._getUser(), obj._conf, 'any') or
             RCCollaborationAdmin.hasRights(obj._rh._getUser()) or RCCollaborationPluginAdmin.hasRights(obj._rh._getUser(), plugins='any')):
         params['Video Services'] = wcomponents.SideMenuItem(_("Video Services"), UHConfModifCollaboration.getURL(obj._conf, secure=obj._rh.use_https()))
Exemplo n.º 10
0
 def _checkProtection(self):
     if not RCVideoServicesManager.hasRights(self._getUser(), self._conf):
         CollaborationBase._checkProtection(self)
Exemplo n.º 11
0
 def fillManagementSideMenu(cls, obj, params={}):
     csbm = Catalog.getIdx("cs_bookingmanager_conference").get(obj._conf.getConference().getId())
     if csbm is not None and csbm.isCSAllowed(obj._rh.getAW().getUser()) and \
         (obj._conf.canModify(obj._rh.getAW()) or RCVideoServicesManager.hasRights(obj._rh._getUser(), obj._conf, 'any') or
             RCCollaborationAdmin.hasRights(obj._rh._getUser()) or RCCollaborationPluginAdmin.hasRights(obj._rh._getUser(), plugins='any')):
         params['Video Services'] = wcomponents.SideMenuItem(_("Video Services"), UHConfModifCollaboration.getURL(obj._conf, secure=obj._rh.use_https()))