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

Allow space application supporter to access specific audit event endpoints. #2216

Closed
monamohebbi opened this issue Apr 21, 2021 · 1 comment · Fixed by #2324
Closed

Allow space application supporter to access specific audit event endpoints. #2216

monamohebbi opened this issue Apr 21, 2021 · 1 comment · Fixed by #2324
Assignees
Labels
space-application-supporter https://github.com/cloudfoundry/cfar-proposals/issues/22

Comments

@monamohebbi
Copy link
Contributor

monamohebbi commented Apr 21, 2021

Issue

Allow space application supporter to access specific audit event endpoints.

Context

We are introducing a new role and we want to make sure it has the right access.

Expected result

A space application support should be able access the following endpoints:

GET /v3/audit_events/:guid
GET /v3/audit_events

Acceptance

A space application supporter would see the same info as a space developer assigned to the same space for these and only these audit endpoints.

Documentation

When I browse to any of these endpoints on v3 docs I can see the Space Application Supporter role in the list of permitted roles with an indication that this role is not fully implemented and the permissions will be changing.

@ctlong ctlong added the space-application-supporter https://github.com/cloudfoundry/cfar-proposals/issues/22 label Apr 21, 2021
@ctlong
Copy link
Member

ctlong commented Jun 8, 2021

Ran into trouble changing permissions on Event due to the controller's use of the old school user_visibility_filter function in the model.

def self.user_visibility_filter(user)
# use select_map so the query is run now instead of being added as a where filter later. When this instead
# generates a subselect in the filter query directly, performance degrades significantly in MySQL.
Sequel.or([
[:space_guid, Space.dataset.join_table(:inner, :spaces_developers, space_id: :id, user_id: user.id).select(:guid).
union(
Space.dataset.join_table(:inner, :spaces_auditors, space_id: :id, user_id: user.id).select(:guid)
).select_map(:guid)],
[:organization_guid, Organization.dataset.where(auditors: user).select_map(:guid)]
])
end

Ideally, we want to update the controller to use Roles.

ctlong added a commit that referenced this issue Jun 9, 2021
* Refactored v3 Events permissions checks to be in the permissions
queryer because we believe that to be the desired pattern + easier to
follow.
* Updated documentation.

[#2216]

Co-authored-by: Carson Long <[email protected]>
Co-authored-by: Mona Mohebbi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
space-application-supporter https://github.com/cloudfoundry/cfar-proposals/issues/22
Projects
None yet
3 participants