当前位置: 首页>>代码示例>>Python>>正文


Python api.AdminApi类代码示例

本文整理汇总了Python中MaKaC.plugins.Collaboration.Vidyo.api.api.AdminApi的典型用法代码示例。如果您正苦于以下问题:Python AdminApi类的具体用法?Python AdminApi怎么用?Python AdminApi使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了AdminApi类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: deleteRoom

    def deleteRoom(cls, booking, roomId):
        confId = booking.getConference().getId()
        bookingId = booking.getId()

        try:
            AdminApi.deleteRoom(roomId)
        except WebFault, e:
            faultString = e.fault.faultstring
            if faultString.startswith('Room not found for roomID'):
                return VidyoError("unknownRoom", "delete")
            else:
                Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's deleteRoom operation got WebFault: %s""" %
                            (confId, bookingId, e.fault.faultstring))
                raise
开发者ID:pferreir,项目名称:indico-backup,代码行数:14,代码来源:operations.py

示例2: setModeratorPIN

    def setModeratorPIN(cls, booking):
        confId = booking.getConference().getId()
        bookingId = booking.getId()
        roomId = booking.getRoomId()
        moderatorPIN = booking.getModeratorPin()

        try:
            AdminApi.setModeratorPIN(roomId, moderatorPIN)
        except WebFault, e:
            faultString = e.fault.faultstring
            if faultString.startswith('Room not found for roomID'):
                return VidyoError("unknownRoom", "setModeratorPIN")
            else:
                Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's setModeratorPIN operation got WebFault: %s""" %
                            (confId, bookingId, e.fault.faultstring))
开发者ID:pferreir,项目名称:indico-backup,代码行数:15,代码来源:operations.py

示例3: setAutomute

    def setAutomute(cls, booking):
        confId = booking.getConference().getId()
        bookingId = booking.getId()
        roomId = booking.getRoomId()
        autoMute = booking.getBookingParamByName("autoMute")

        try:
            AdminApi.setAutomute(roomId, autoMute)
        except WebFault, e:
            faultString = e.fault.faultstring
            if faultString.startswith('Room not found for roomID'):
                return VidyoError("unknownRoom", "setAutomute")
            else:
                Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's setAutomute operation got WebFault: %s""" %
                            (confId, bookingId, e.fault.faultstring))
开发者ID:pferreir,项目名称:indico-backup,代码行数:15,代码来源:operations.py

示例4: roomWithSameOwner

    def roomWithSameOwner(cls, owner, roomName):
        # we retrieve the just created room; we need to do this because Vidyo will have
        # added extra data like the room id, the url
        searchFilter = SOAPObjectFactory.createFilter('admin', roomName)
        answer = AdminApi.getRooms(searchFilter)
        createdRooms = answer.room

        for room in createdRooms:
            if str(room.name) == roomName and str(room.ownerName) == owner:
                return room
        return None
开发者ID:pferreir,项目名称:indico-backup,代码行数:11,代码来源:operations.py

示例5: connectRoom

 def connectRoom(cls, booking, roomId, extension):
     confId = booking.getConference().getId()
     bookingId = booking.getId()
     try:
         searchFilter = SOAPObjectFactory.createFilter('user', extension)
         userApiAnswer = UserApi.search(searchFilter, confId, bookingId)
         if userApiAnswer.total == 0:
             return VidyoError("noExistsRoom", "connect", _("The conference room is not registered in the vidyo service. ") + VidyoTools.getContactSupportText())
         legacyMember = userApiAnswer.Entity[0].entityID
         AdminApi.connectRoom(roomId, confId, bookingId, legacyMember)
     except WebFault, e:
         faultString = e.fault.faultstring
         if faultString.startswith('ConferenceID is invalid'):
             return VidyoError("unknownRoom", "connect")
         if faultString.startswith('Failed to Invite to Conference'):
             message = _("The connection has failed. ") + VidyoTools.getContactSupportText()
             return VidyoError("connectFailed", "connect", message)
         else:
             Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's connectRoom operation got WebFault: %s""" %
                     (confId, bookingId, e.fault.faultstring))
             raise
开发者ID:vstitches,项目名称:indico,代码行数:21,代码来源:operations.py

示例6: connectRoom

 def connectRoom(cls, booking, roomId, extension):
     confId = booking.getConference().getId()
     bookingId = booking.getId()
     try:
         searchFilter = SOAPObjectFactory.createFilter('user', extension)
         userApiAnswer = UserApi.search(searchFilter, confId, bookingId)
         legacyMember = userApiAnswer.Entity[0].entityID
         AdminApi.connectRoom(roomId, confId, bookingId, legacyMember)
     except WebFault, e:
         faultString = e.fault.faultstring
         if faultString.startswith('ConferenceID is invalid'):
             return VidyoError("unknownRoom", "connect")
         if faultString.startswith('Failed to Invite to Conference'):
             message = _("The connection has failed.")
             if getVidyoOptionValue("contactSupport"):
                 message += _("""\nPlease try again or contact %s for help.""")%getVidyoOptionValue("contactSupport")
             return VidyoError("connectFailed", "connect", message)
         else:
             Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's connectRoom operation got WebFault: %s""" %
                     (confId, bookingId, e.fault.faultstring))
             raise
开发者ID:bubbas,项目名称:indico,代码行数:21,代码来源:operations.py

示例7: searchRooms

    def searchRooms(cls, query):
        try:
            searchFilter = SOAPObjectFactory.createFilter('admin', "%%%s%%" % VidyoTools.replaceSpacesInName(query))
            rooms = AdminApi.getRooms(searchFilter)
            if rooms.total:
                return rooms.room
            return []

        except WebFault, e:
            Logger.get('Vidyo').exception("""Admin API's searchRooms operation got WebFault: %s"""
                                          % e.fault.faultstring)
            raise
开发者ID:Json-Andriopoulos,项目名称:indico,代码行数:12,代码来源:operations.py

示例8: attachRoom

    def attachRoom(cls, booking):
        owner = booking.getOwnerObject()
        possibleLogins = VidyoTools.getAvatarLoginList(owner)
        if not possibleLogins:
            return VidyoError("userHasNoAccounts", "attach")
        roomName = booking.getBookingParamByName("roomName")
        searchFilter = SOAPObjectFactory.createFilter('admin', roomName)
        answer = AdminApi.getRooms(searchFilter, booking.getConference().getId(), booking.getId())
        createdRooms = answer.room

        for room in createdRooms:
            for login in possibleLogins:
                if str(room.name) == roomName and str(room.ownerName) == login:
                    return room
        else:
            return  VidyoError("notValidRoom", "attach")
开发者ID:ferhatelmas,项目名称:indico,代码行数:16,代码来源:operations.py

示例9: attachRoom

    def attachRoom(cls, booking):
        owner = booking.getOwnerObject()
        possibleLogins = VidyoTools.getAvatarLoginList(owner)
        if not possibleLogins:
            return VidyoError("userHasNoAccounts", "attach")
        roomName = booking.getBookingParamByName("roomName")
        searchFilter = SOAPObjectFactory.createFilter('admin', roomName)

        # TODO: Do several calls if needed
        # Vidyo should have an exact match feature too
        searchFilter.limit = 100

        answer = AdminApi.getRooms(searchFilter)
        createdRooms = answer.room

        for room in createdRooms:
            for login in possibleLogins:
                if str(room.name) == roomName and str(room.ownerName) == login:
                    return room
        else:
            return VidyoError("notValidRoom", "attach")
开发者ID:pferreir,项目名称:indico-backup,代码行数:21,代码来源:operations.py

示例10: queryRoom

    def queryRoom(cls, booking, roomId):
        """ Searches for room information via the admin api's getRoom function and the
            user api's search function (currently the admin api's getRoom is not reliable
            to retrieve name, description and groupName).
            Tries to find the room providing the extension as query (since only
            the room name and extension are checked by the search op).
            Returns None if not found
        """
        confId = booking.getConference().getId()
        bookingId = booking.getId()

        roomId = booking.getRoomId()

        try:
            adminApiRoom = AdminApi.getRoom(roomId)
        except WebFault, e:
            faultString = e.fault.faultstring
            if faultString.startswith('Room not found for roomID'):
                return VidyoError("unknownRoom", "checkStatus")
            else:
                Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's getRoom operation got WebFault: %s""" %
                            (confId, bookingId, e.fault.faultstring))
                raise
开发者ID:pferreir,项目名称:indico-backup,代码行数:23,代码来源:operations.py

示例11: createRoom

    def createRoom(cls, booking):
        """ Attempts to create a public room in Vidyo.
            Returns None on success. Will also set booking.setAccountName() if success, with the Indico & Vidyo login used successfully.
            Returns a VidyoError instance if there are problems.

            :param booking: the CSBooking object inside which we try to create the room
            :type booking: MaKaC.plugins.Collaboration.Vidyo.collaboration.CSBooking
        """
        # we extract the different parameters
        # We set the original conference id because the bookings can belong to more than one conference and being cloned
        # and it is used for the long name, we need to keep always the same confId
        confId = booking.getConference().getId()

        bookingId = booking.getId()
        roomName = booking.getBookingParamByName("roomName")
        description = booking.getBookingParamByName("roomDescription")
        owner = booking.getOwnerObject()
        pin = booking.getPin()
        moderatorPin = booking.getModeratorPin()

        #we obtain the unicode object with the proper format for the room name
        roomNameForVidyo = VidyoTools.roomNameForVidyo(roomName)
        if isinstance(roomNameForVidyo, VidyoError):
            return roomNameForVidyo

        #we turn the description into a unicode object
        description = VidyoTools.descriptionForVidyo(description)
        if isinstance(description, VidyoError):
            return description

        #we obtain the most probable extension
        #TODO: there's a length limit for extensions, check this
        baseExtension = getVidyoOptionValue("prefix") + confId
        extension = baseExtension
        extensionSuffix = 1

        #we produce the list of possible account names. We will loop through them to attempt to create the room
        possibleLogins = VidyoTools.getAvatarLoginList(owner)
        if not possibleLogins:
            return VidyoError("userHasNoAccounts", "create")

        # We check the moderator PIN is a 3-10 digit number
        if moderatorPin and (not moderatorPin.isdigit() or len(moderatorPin) < 3 or len(moderatorPin) > 10):
            return VidyoError("PINLength", "create")

        roomCreated = False
        loginToUse = 0

        while not roomCreated and loginToUse < len(possibleLogins):
            #we loop changing the ownerName and the extension until room is created

            newRoom = SOAPObjectFactory.createRoom(roomNameForVidyo, description, possibleLogins[loginToUse], extension, pin, moderatorPin)
            try:
                AdminApi.addRoom(newRoom)
                roomCreated = True

            except WebFault, e:
                faultString = e.fault.faultstring

                if faultString.startswith('Room exist for name'):
                    if VidyoOperations.roomWithSameOwner(possibleLogins[loginToUse], roomNameForVidyo):
                        return VidyoError("duplicatedWithOwner", "create")
                    else:
                        return VidyoError("duplicated", "create")

                elif faultString.startswith('Member not found for ownerName'):
                    loginToUse = loginToUse + 1

                elif faultString.startswith('PIN should be a 3-10 digit number'):
                        return VidyoError("PINLength", "create")

                elif faultString.startswith('Room exist for extension'):
                    extension = baseExtension + str(extensionSuffix)
                    extensionSuffix = extensionSuffix + 1
                else:
                    Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's addRoom operation got WebFault: %s""" %
                                (confId, bookingId, e.fault.faultstring))
                    raise
开发者ID:pferreir,项目名称:indico-backup,代码行数:78,代码来源:operations.py

示例12: modifyRoom

    def modifyRoom(cls, booking, oldBookingParams):

        # we extract the different parameters
        # We set the original conference id because the bookings can belong to more than one conference and being cloned
        # and it is used for the long name, we need to keep always the same confId
        confId = booking.getConference().getId()
        bookingId = booking.getId()
        roomId = booking.getRoomId()
        roomName = booking.getBookingParamByName("roomName")
        description = booking.getBookingParamByName("roomDescription")
        newOwner = booking.getOwnerObject() #an avatar object
        ownerAccountName = booking.getOwnerAccount() #a str
        oldOwner = oldBookingParams["owner"] #an IAvatarFossil fossil
        pin = booking.getPin()
        moderatorPin = booking.getModeratorPin()

        #we obtain the unicode object with the proper format for the room name
        roomNameForVidyo = VidyoTools.roomNameForVidyo(roomName)
        if isinstance(roomNameForVidyo, VidyoError):
            return roomNameForVidyo

        #we turn the description into a unicode object
        description = VidyoTools.descriptionForVidyo(description)
        if isinstance(description, VidyoError):
            return description

        #(the extension will not change)

        #we check if the owner has changed. If not, we reuse the same accountName
        useOldAccountName = True
        possibleLogins = []
        if newOwner.getId() != oldOwner["id"]:
            useOldAccountName = False
            #we produce the list of possible account names. We will loop through them to attempt to create the room
            possibleLogins = VidyoTools.getAvatarLoginList(newOwner)
            if not possibleLogins:
                raise CollaborationException(_("The moderator has no login information"))

        # We check the moderator PIN is a 3-10 digit number
        if moderatorPin and (not moderatorPin.isdigit() or len(moderatorPin) < 3 or len(moderatorPin) > 10):
            return VidyoError("PINLength", "modify")

        roomModified = False
        loginToUse = 0
        while not roomModified and (useOldAccountName or loginToUse < len(possibleLogins)):

            if not useOldAccountName:
                ownerAccountName = possibleLogins[loginToUse]

            newRoom = SOAPObjectFactory.createRoom(roomNameForVidyo, description, ownerAccountName, booking.getExtension(), pin, moderatorPin)
            try:
                AdminApi.updateRoom(roomId, newRoom)
                roomModified = True

            except WebFault, e:
                faultString = e.fault.faultstring

                if faultString.startswith('Room not exist for roomID'):
                    return VidyoError("unknownRoom", "modify")

                elif faultString.startswith('Room exist for name'):
                    return VidyoError("duplicated", "modify")

                elif faultString.startswith('Member not found for ownerName'):
                    if useOldAccountName:
                        #maybe the user was deleted between the time the room was created and now
                        return VidyoError("badOwner", "modify")
                    else:
                        loginToUse = loginToUse + 1

                elif faultString.startswith('PIN should be a 3-10 digit number'):
                        return VidyoError("PINLength", "modify")

                else:
                    Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's updateRoom operation got WebFault: %s""" %
                                    (confId, bookingId, e.fault.faultstring))
                    raise
开发者ID:pferreir,项目名称:indico-backup,代码行数:77,代码来源:operations.py

示例13: VidyoError

                        return VidyoError("PINLength", "modify")

                else:
                    Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's updateRoom operation got WebFault: %s""" %
                                    (confId, bookingId, e.fault.faultstring))
                    raise

        #if we could not create the room, the owner did not have any Vidyo accounts
        if not roomModified and loginToUse == len(possibleLogins):
            return VidyoError("badOwner", "modify")


        # we retrieve the just created room; we need to do this because Vidyo will have
        # added extra data like the room id, the url
        try:
            modifiedRoom = AdminApi.getRoom(roomId)
        except WebFault, e:
            faultString = e.fault.faultstring
            if faultString.startswith('Room not found for roomID'):
                return VidyoError("unknownRoom", "modify")
            else:
                Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's getRoom operation got WebFault: %s""" %
                            (confId, bookingId, e.fault.faultstring))
                raise

        return modifiedRoom

    @classmethod
    def setAutomute(cls, booking):
        confId = booking.getConference().getId()
        bookingId = booking.getId()
开发者ID:pferreir,项目名称:indico-backup,代码行数:31,代码来源:operations.py

示例14: len

                        loginToUse = loginToUse + 1

                else:
                    Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's updateRoom operation got WebFault: %s""" %
                                    (confId, bookingId, e.fault.faultstring))
                    raise

        #if we could not create the room, the owner did not have any Vidyo accounts
        if not roomModified and loginToUse == len(possibleLogins):
            return VidyoError("badOwner", "modify")


        # we retrieve the just created room; we need to do this because Vidyo will have
        # added extra data like the room id, the url
        try:
            modifiedRoom = AdminApi.getRoom(roomId, confId, bookingId)
        except WebFault, e:
            faultString = e.fault.faultstring
            if faultString.startswith('Room not found for roomID'):
                return VidyoError("unknownRoom", "modify")
            else:
                Logger.get('Vidyo').exception("""Evt:%s, booking:%s, Admin API's getRoom operation got WebFault: %s""" %
                            (confId, bookingId, e.fault.faultstring))
                raise

        return modifiedRoom

    @classmethod
    def setAutomute(cls, booking):
        confId = booking.getConference().getId()
        bookingId = booking.getId()
开发者ID:vstitches,项目名称:indico,代码行数:31,代码来源:operations.py


注:本文中的MaKaC.plugins.Collaboration.Vidyo.api.api.AdminApi类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。