Ejemplo n.º 1
0
def build_Q(this_user, user_base_config, these_groups):
    """ This receives:
    a user,
    a config, conditioned by a single top_group,
    a set of groups in the same family tree.
    It is just of a single resource. We're going to build a complex
    Q object with this tool.
    """
    get_bits = user_base_config['methods']['GET']
    logging.info('user_base_config = %s' % user_base_config)
    # First, see if the 'world' can GET this.
    # If so, what's with all this complicated stuff?
    needed_groups = []
    needed_user = []
    if can('world', 'execute', get_bits):
        return ([], [])
    elif can('group', 'execute', get_bits):
        needed_groups.extend(these_groups)
    if can('owner', 'execute', get_bits):
        needed_user.append(this_user)
    return (needed_groups, needed_user)
Ejemplo n.º 2
0
 def test_can(self):
     result = permit.can('group', 'write', '0761')
     self.assertTrue(result)