Пример #1
0
    def call(self, sender, log, **kw):
        log.debug('Zenoss Admin user plugin running with %s' % sender)

        sender = sender.lower()

        # remove the resource from the sender
        if '/' in sender:
            sender = sender.split('/')[0]

        adapter = ZenAdapter()

        if sender == None: return False
        log.debug('Got a message from %s.  Going to look for a Zenoss user to map it to.' % sender)
        # look through all zenoss users until we find one with the sender's JabberID
        for user in adapter.userSettings():
            try:
                jabberProperty = user.getProperty('JabberId').lower()
            except:
                jabberProperty = None
            if jabberProperty == sender:
                log.debug('JabberID %s maps to the sender: %s.  This user is authorized.' % (jabberProperty, sender))
                return True

        log.debug('Unable to find a Zenoss user with jabberId!  This sender is NOT authorized: %s' % sender)
        return False
Пример #2
0
    def call(self, sender, log, **kw):
        log.debug('Zenoss Admin user plugin running with %s' % sender)

        sender = sender.lower()

        # remove the resource from the sender
        if '/' in sender:
            sender = sender.split('/')[0]

        adapter = ZenAdapter()

        if sender == None: return False
        log.debug(
            'Got a message from %s.  Going to look for a Zenoss user to map it to.'
            % sender)
        # look through all zenoss users until we find one with the sender's JabberID
        for user in adapter.userSettings():
            try:
                jabberProperty = user.getProperty('JabberId').lower()
            except:
                jabberProperty = None
            if jabberProperty == sender:
                log.debug(
                    'JabberID %s maps to the sender: %s.  This user is authorized.'
                    % (jabberProperty, sender))
                return True

        log.debug(
            'Unable to find a Zenoss user with jabberId!  This sender is NOT authorized: %s'
            % sender)
        return False
Пример #3
0
 def call(self, args, log, **kw):
     log.debug('Users plugin running with arguments %s' % args)
     # TODO switch this to optparse and make sure help works.
     adapter = ZenAdapter()
     users = []
     message = 'No Users'
     haveUser = False
     for user in adapter.userSettings():
         haveUser = True
         try:
             jabberId = user.getProperty('JabberId') or 'No JabberId'
         except AttributeError:
             jabberId = 'No JabberId'
         users.append('%s (%s)' % (user.id, jabberId))
     if haveUser:
         message = '\n'.join(users)
     return message
Пример #4
0
 def call(self, args, log, **kw):
     log.debug('Users plugin running with arguments %s' % args)
     # TODO switch this to optparse and make sure help works.
     adapter = ZenAdapter()
     users = []
     message = 'No Users'
     haveUser = False
     for user in adapter.userSettings():
         haveUser = True
         try:
             jabberId = user.getProperty('JabberId') or 'No JabberId'
         except AttributeError:
             jabberId = 'No JabberId'
         users.append('%s (%s)' % (user.id, jabberId))
     if haveUser:
         message = '\n'.join(users)
     return message