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

Copy roles matching pattern using External API #25

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,12 @@ jobs:
env: name=translation-progress
script:
- shellcheck release-management/translation-progress/translation-progress.sh

- stage: test
env: name=acl-on-series-and-events
language: node_js
node_js:
- 8
script:
- cd acl-on-series-and-events && npm install && npm run lint

12 changes: 12 additions & 0 deletions acl-on-series-and-events/.eslintrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
env:
browser: true
es6: true
extends:
- google
globals:
Atomics: readonly
SharedArrayBuffer: readonly
parser: "babel-eslint"
parserOptions:
ecmaVersion: 2020
rules: {}
1 change: 1 addition & 0 deletions acl-on-series-and-events/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
51 changes: 51 additions & 0 deletions acl-on-series-and-events/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# ACL on Series and Events

Collection of scripts dealing with ACLs on Series and Events using
the API.

Target audience: Opencast system administrators.

## src/migrate_roles.js

Copy Access-Control-List (ACL) rules of Series and Events matching
`ROLE_PATTERN` to `ROLE_COPY` using the External API using a browser's
Web Console.

### The User Story
There were about 3000 Events and 300 Series in an Opencast installation
that needed their Role-Prefix in ACLs changed due to the way Opencast
has been integrated in ILIAS. Published Events needed their meta data
republished in Engage. The process should take place during normal
operations (visitors watching videos, lectures being recorded, recordings
being processed) without too much impact on user experience.

### Usage
1. Adjust the constants on top of this script according to your setup.
2. Open your Opencast Admin interface in a compatible browser, log in,
and navigate to your REST-API docs. By default, they are located at
`/rest_docs.html`
3. Open your Browser's web console and the network tab. Make logging
persistent. Switch to the console tab.
4. Copy your modified version of the script into the clipboard, paste
its contents to the browser's console and hit enter.
5. The script starts to run. You can interrupt the script at any time
by reloading the page.
6. You can inspect the HTTP requests to the External API, switching to
your browser's network tab.
7. When the script has finished, it says "done" in your browser console.
8. Since the script will not write anything to the API if there were no
changes and the script will also avoid adding duplicate rules, the
script can be run multiple times, for instance if some events or series
could not be changed due to Workflows running on them.

### Compatibility
Makes use of Public field declarations in Classes as proposed at TC39,
the JavaScript standards committee. Tested in Mozilla Firefox 72.
https://github.com/tc39/proposal-class-fields
Makes use of jQuery for AJAX-Requests, which is shipped with Opencast.

### Limitations
The script does not yet support pagination. All Events and Series are
obtained, up to a limit or none, at once. This may not cover all your
Events/Series in Opencast or may crash your browser if the list is too
huge.
Loading