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

Make event ACL editable via Tobira #1272

Merged
merged 8 commits into from
Dec 9, 2024

Conversation

owi92
Copy link
Member

@owi92 owi92 commented Nov 5, 2024

This will allow users to update event ACL in Opencast via Tobira. Doing so will trigger the republish-metadata workflow, so the changes will be propagated to all publications.

Closes #1264
can be reviewed commit by commit

@owi92 owi92 added area:api API (design and backend implementation) changelog:user User facing changes labels Nov 5, 2024
@oas777
Copy link
Collaborator

oas777 commented Nov 5, 2024

It TRIGGERS the republish-metadata workflow? Automatically? No additional action needed? Thank you!

@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 November 5, 2024 17:39 Destroyed
@owi92
Copy link
Member Author

owi92 commented Nov 5, 2024

Yes, correct. Though that might still fail, or take some time.
To reflect the changes in Tobira immediately, it will also be written to our DB, without having to wait for the workflow and the following sync... but that's getting into technicalities.

So tldr: In a perfect world, there's no additional action needed ;)

@oas777
Copy link
Collaborator

oas777 commented Nov 7, 2024

Ole, is https://pr1272.tobira.opencast.org/ still the deployment I should be looking at? If so, I have two minor (!) remarks:

  • The confirmation for having saved my changes by greying out the buttons "Reset" and "Save" is very low-key because it's grey to start with - shouldn't it be blueish, then grey out? Cf.

image

  • Shouldn't the symbol for "Access policy" have a checkmark inside the shield?

@owi92
Copy link
Member Author

owi92 commented Nov 8, 2024

is https://pr1272.tobira.opencast.org/ still the deployment I should be looking at

Yes. Thank you for the feedback, I think these are good points. Will change accordingly.

@owi92 owi92 marked this pull request as draft November 8, 2024 12:54
@owi92 owi92 force-pushed the event-acl-editing branch from 7a3e745 to faa8d96 Compare November 11, 2024 20:56
@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 November 11, 2024 21:02 Destroyed
@owi92 owi92 force-pushed the event-acl-editing branch from faa8d96 to 5ccb07d Compare November 11, 2024 21:04
@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 November 11, 2024 21:07 Destroyed
@owi92 owi92 marked this pull request as ready for review November 11, 2024 21:20

This comment was marked as resolved.

@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Nov 18, 2024
@owi92 owi92 force-pushed the event-acl-editing branch from 5ccb07d to b6a45bd Compare November 19, 2024 11:14
@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Nov 19, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 November 19, 2024 11:19 Destroyed
@owi92 owi92 force-pushed the event-acl-editing branch from b6a45bd to cce8143 Compare November 19, 2024 11:28
@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 November 19, 2024 11:31 Destroyed
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, this will add a big and long awaited feature! Just a bunch of notes, as far as I remember all should be pretty easy to fix.

backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/acl.rs Outdated Show resolved Hide resolved
backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/mutation.rs Outdated Show resolved Hide resolved
backend/src/sync/client.rs Outdated Show resolved Hide resolved
backend/src/sync/client.rs Outdated Show resolved Hide resolved
frontend/src/i18n/locales/en.yaml Outdated Show resolved Hide resolved
frontend/src/routes/manage/Video/Shared.tsx Outdated Show resolved Hide resolved
frontend/src/util/err.tsx Outdated Show resolved Hide resolved
@owi92 owi92 force-pushed the event-acl-editing branch from cce8143 to 36a64d0 Compare November 25, 2024 11:16
@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 November 25, 2024 11:19 Destroyed
@github-actions github-actions bot added the status:conflicts This PR has conflicts that need to be resolved label Dec 3, 2024

This comment was marked as resolved.

Doing this whenever I spot some.
@owi92 owi92 force-pushed the event-acl-editing branch from 36a64d0 to a2545d6 Compare December 3, 2024 13:58
@github-actions github-actions bot removed the status:conflicts This PR has conflicts that need to be resolved label Dec 3, 2024
@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 December 3, 2024 14:04 Destroyed
Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes, did not yet test again. It also sounded like you still want to comment in the preview role stuff, so i expect I will do another short review round anyway.

backend/src/api/model/event.rs Outdated Show resolved Hide resolved
backend/src/api/model/realm/mutations.rs Outdated Show resolved Hide resolved
backend/src/api/mutation.rs Outdated Show resolved Hide resolved
backend/src/sync/client.rs Outdated Show resolved Hide resolved
frontend/src/routes/manage/Video/Access.tsx Outdated Show resolved Hide resolved
@owi92 owi92 force-pushed the event-acl-editing branch from a2545d6 to b1e9e72 Compare December 3, 2024 22:14
@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 December 3, 2024 22:17 Destroyed
@owi92
Copy link
Member Author

owi92 commented Dec 3, 2024

I addressed your latest comments. Regarding preview_roles stuff:
I mixed some things up when I said I wanted to comment them in. They still need to be commented out in event.rs where it would get written to the DB, since the frontend is not sending them yet (same with custom roles). Once frontend sends the complete ACL, the commented out code there can and should get activated.

What I did do, now that preview_roles are a column in the events table: I added them to the request to Opencast, so they won't get overwritten when the event is synced with updated ACLs (custom roles were already included). That is done in update_event_acl in client.rs.

If you want to test this locally, to see if preview and custom roles will stick around:

  • use a synced video from your local Opencast
  • update the ACL in your Tobira DB with:
update all_events
set custom_action_roles = '{"focus": ["ROLE_USER_ADMIN", "ROLE_USER_SABINE"], "durdle": ["ROLE_USER_ADMIN"]}', 
preview_roles = '{ROLE_ANONYMOUS}'                                                                       
where title = 'event';
  • then use the ACL editor to do some changes to read/write roles
  • after the metadata has been automatically republished and synced in Tobira, check if the preview and custom roles are still there

Copy link
Member

@LukasKalbertodt LukasKalbertodt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a thing, but I also still need to think about the unresolved comments from my first review.

backend/src/api/model/event.rs Outdated Show resolved Hide resolved
owi92 added 5 commits December 4, 2024 21:16
This adds a mutation that will send a PUT request to
Opencast to update the acl of a given event.
When the request responds with 204, it is considered
successful and the updated acl is stored in Tobira's DB,
without waiting for sync with OC. That allows us to pretend
that things are happening much faster than they do in actuality,
as Opencast needs to run the "republish metadata" workflow in
order to propagate these changes back to Tobira.

There were some discussions and efforts to change how that is
done in Opencast, but the proposed changes didn't make the cut
yet. Once that or sth similar happens, we should also adapt
the mechanism implemented in this commit.
This adds the necessary changes for the interface
to commit the mutation added in the previous commit.
Also fixes some minor UX issues.
So far this is only needed for republishing metadata
in case of acl updates. We might need this in other places,
so I made a dedicated function for it.
Of course we might also remove it again, if future Opencast
changes make it redundant. We'll see.
Not sure if the default should be `true` or `false` for this.
This endpoint allows us to check whether there
are any workflows running in Opencast for an event.
Also added are error handling and blocking of acl
editing based on that check.
@owi92 owi92 force-pushed the event-acl-editing branch from b1e9e72 to 9784132 Compare December 4, 2024 20:16

This comment has been minimized.

@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 December 4, 2024 20:19 Destroyed
owi92 added 2 commits December 9, 2024 13:51
This changes the overall error component to accept
ReactNodes instead of just strings as error cause.
With this, we can pass it any element, including
the i18next `<Trans>` component, which is needed
to include most html tags in the error.
@owi92 owi92 force-pushed the event-acl-editing branch from 9784132 to 96ed8fe Compare December 9, 2024 14:51
Copy link

github-actions bot commented Dec 9, 2024

🚨🚨🚨 This PR changes APIs used by the Opencast Admin UI integration 🚨🚨🚨

Detected the following changes (1) between schemas:

✔  Field Realm.nameSource description changed from The raw information about the name of the realm, showing where the name
is coming from and if there is no name, why that is. Can be `null` only for the
root realm, must be non-null for all other realms. to The raw information about the name of the realm, showing where the name
is coming from and if there is no name, why that is. Is `null` for the
root realm, non-null for all other realms.

@github-actions github-actions bot temporarily deployed to test-deployment-pr1272 December 9, 2024 14:53 Destroyed
@LukasKalbertodt LukasKalbertodt merged commit 68d98d9 into elan-ev:next Dec 9, 2024
5 checks passed
@owi92 owi92 deleted the event-acl-editing branch December 10, 2024 12:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:api API (design and backend implementation) changelog:user User facing changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants