Ejemplo n.º 1
0
    def _check_permissions(self, msg):
        allowed = permissions.get(config.controller['permissions_path'])
        perms = permissions.check(allowed, self.sender, msg['collection'],
                                  msg['id'])

        if self.body['action'] not in perms:
            raise ValueError("You don't have permission to do that.")
Ejemplo n.º 2
0
    def _check_permissions(self, msg):
        allowed = permissions.get(config.controller['permissions_path'])
        perms = permissions.check(allowed,
                                  self.sender,
                                  msg['collection'],
                                  msg['id'])

        if self.body['action'] not in perms:
            raise ValueError("You don't have permission to do that.")
Ejemplo n.º 3
0
    def test_lines_order_matter_success(self):
        fp = self._get_fp('permissions.conf')
        perm_list = permissions.get(fp)

        user = '******'
        collection = 'files'
        res_id = '/etc/hosts'
        action = 'update'
        perms = permissions.check(perm_list, user, collection, res_id)

        self.assertTrue(action in perms)
Ejemplo n.º 4
0
    def test_lines_order_matter_fail(self):
        fp = self._get_fp('permissions.conf')
        perm_list = permissions.get(fp)

        user = '******'
        collection = 'executables'
        res_id = 'rm -rf /'
        action = 'update'
        perms = permissions.check(perm_list, user, collection, res_id)

        self.assertFalse(action in perms)
Ejemplo n.º 5
0
    def test_lines_order_matter_success(self):
        fp = self._get_fp('permissions.conf')
        perm_list = permissions.get(fp)

        user = '******'
        collection = 'files'
        res_id = '/etc/hosts'
        action = 'update'
        perms = permissions.check(perm_list, user, collection, res_id)

        self.assertTrue(action in perms)
Ejemplo n.º 6
0
    def test_lines_order_matter_fail(self):
        fp = self._get_fp('permissions.conf')
        perm_list = permissions.get(fp)

        user = '******'
        collection = 'executables'
        res_id = 'rm -rf /'
        action = 'update'
        perms = permissions.check(perm_list, user, collection, res_id)

        self.assertFalse(action in perms)
Ejemplo n.º 7
0
    def __init__(self, scheduler=None, tasks_queue=None, publish_queue=None):

        self.logger.debug("Initializing the controller...")
        Thread.__init__(self, name="CONTROLLER")
        permissions_path = config.controller['permissions_path']

        try:
            self.permissions = permissions.get(permissions_path)
        except (IOError, OSError) as err:
            self.logger.critical(err)
            raise SystemExit

        self.uuid = config.rabbitmq['uuid']
        self.tasks_queue = tasks_queue
        self.publish_queue = publish_queue
        self.locator = ResourceLocator(scheduler, publish_queue)
        self.logger.debug("Controller successfully initialized.")
Ejemplo n.º 8
0
    def __init__(self, scheduler=None, tq=None, pq=None):

        self.logger.debug("Initializing the controller...")
        Thread.__init__(self, name="CONTROLLER")
        permissions_path = config.controller['permissions_path']

        try:
            self.permissions = permissions.get(permissions_path)
        except (IOError, OSError) as err:
            self.logger.critical(err)
            raise SystemExit

        self.uuid = config.rabbitmq['uuid']
        self.tq = tq
        self.pq = pq
        self.locator = ResourceLocator(scheduler, pq)
        self.logger.debug("Controller successfully initialized.")
Ejemplo n.º 9
0
 def test_blank_lines_dont_matter(self):
     fp = self._get_fp('permissions.conf')
     permissions.get(fp)
Ejemplo n.º 10
0
 def test_blank_lines_dont_matter(self):
     fp = self._get_fp('permissions.conf')
     permissions.get(fp)