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

Cannot use entity-permission for the url-policy #37

Closed
stcarrez opened this issue Dec 4, 2022 · 0 comments
Closed

Cannot use entity-permission for the url-policy #37

stcarrez opened this issue Dec 4, 2022 · 0 comments
Labels

Comments

@stcarrez
Copy link
Owner

stcarrez commented Dec 4, 2022

When we have an entity permission like:

  <entity-permission>
    <name>member-view</name>
    <entity-type>awa_workspace</entity-type>
    <description>Grant the member view </description>
    <sql>
       SELECT acl.id FROM awa_acl AS acl
            WHERE acl.entity_type = :entity_type
            AND acl.user_id = :user_id
            AND acl.entity_id = 1
            AND acl.permission = $permission[member-view]
    </sql>
  </entity-permission>

if we want to use the permission in an url-policy like:

  <url-policy>
    <permission>member-view</permission>
    <url-pattern>/members/admin/.*</url-pattern>
    <url-pattern>/members/.*</url-pattern>
  </url-policy>

then the entity-permission is always rejected because when we evaluate it there is no entity-id to evaluate and the permission controller immediately reject the permission even if the SQL query does not make reference to the entity-id.

If the SQL does not references the :entity_id parameter, then the controller should proceed and run the SQL query to check the permission (instead of rejecting without checking).

@stcarrez stcarrez added the bug label Dec 4, 2022
@stcarrez stcarrez changed the title Fix using entity-permission in the url-policy Cannot use entity-permission for the url-policy Dec 4, 2022
stcarrez pushed a commit that referenced this issue Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant