Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read policy when a token is passed should return policies controlled by the user #150

Open
github-actions bot opened this issue Oct 24, 2022 · 0 comments
Labels
enhancement New feature or request todo
Milestone

Comments

@github-actions
Copy link
Contributor

# TODO CHANGE LOGIC IT SHOULD LIST POLICIES I CONTROL

      - Resource
      - Resource Type
    In case an JWT token is passed over, user id, roles and groups are used to
    filter policies that are only valid for him. Unless the user is super admin or tenant admin.
    To return policies from a service path tree, you can used the wildchar "#".
    For example, using `/Path1/#` you will obtain policies for all subpaths,
    such as: `/Path1/SubPath1` or `/Path1/SubPath1/SubSubPath1`.
    """
    user_info = parse_auth_token(token)
    owner = None
    if user_info and user_info['is_super_admin']:
        owner = None
    elif user_info and user_info['tenants'] and fiware_service in user_info['tenants'] and "roles" in user_info['tenants'][fiware_service] and "tenant-admin" in user_info['tenants'][fiware_service]["roles"]:
        owner = None
    elif user_info and user_info['email']:
        owner = user_info['email']
    # we don't filter policies in case super admin or tenant admin
    # TODO CHANGE LOGIC IT SHOULD LIST POLICIES I CONTROL
    if agent_type and agent_type not in default.DEFAULT_AGENTS and agent_type not in default.DEFAULT_AGENT_TYPES:
        raise HTTPException(
            status_code=422,
@github-actions github-actions bot added the todo label Oct 24, 2022
@chicco785 chicco785 added this to the 1.0 milestone Oct 27, 2022
@chicco785 chicco785 changed the title CHANGE LOGIC IT SHOULD LIST POLICIES I CONTROL read policy when a token is passed should return policies controlled by the user Oct 27, 2022
@chicco785 chicco785 added the enhancement New feature or request label Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request todo
Projects
None yet
Development

No branches or pull requests

1 participant