{"id":29190623,"url":"https://github.com/owncloud/moodle-repository_ocis","last_synced_at":"2025-07-02T00:10:38.247Z","repository":{"id":197174476,"uuid":"697158688","full_name":"owncloud/moodle-repository_ocis","owner":"owncloud","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-20T09:08:21.000Z","size":1275,"stargazers_count":3,"open_issues_count":8,"forks_count":0,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-06-28T18:13:13.866Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/owncloud.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGES.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-09-27T07:11:08.000Z","updated_at":"2024-06-20T09:08:21.000Z","dependencies_parsed_at":"2023-10-04T16:13:51.038Z","dependency_job_id":"28ce5609-ccd7-4beb-a9d1-6651c0bb5dbd","html_url":"https://github.com/owncloud/moodle-repository_ocis","commit_stats":null,"previous_names":["owncloud/moodle-repository_ocis"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/owncloud/moodle-repository_ocis","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fmoodle-repository_ocis","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fmoodle-repository_ocis/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fmoodle-repository_ocis/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fmoodle-repository_ocis/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/owncloud","download_url":"https://codeload.github.com/owncloud/moodle-repository_ocis/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/owncloud%2Fmoodle-repository_ocis/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263052430,"owners_count":23406106,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-07-02T00:10:36.169Z","updated_at":"2025-07-02T00:10:38.206Z","avatar_url":"https://github.com/owncloud.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Integration of Moodle and [oCIS](https://doc.owncloud.com/ocis/next/)\n\nA [Moodle repository](https://docs.moodle.org/402/en/Repositories) that makes files stored in oCIS accessible through the [Moodle file-picker](https://docs.moodle.org/402/en/File_picker).\n\n## Minimum requirement\n- [oCIS PHP SDK](https://github.com/owncloud/ocis-php-sdk/)\n- moodle 4.2\n- PHP 8.1\n- oCIS 5.0\n\n## Main features\n\n### 1. Authentication\nThe existing OAuth2 implementation in Moodle does support OpenID connect, so a custom Oauth2 service is used to connect to oCIS.\n\n### 2. Link files between Moodle \u0026 oCIS using the [Moodle file-picker](https://docs.moodle.org/402/en/File_picker)\n\nThere are three different modes for the Moodle user to link files from oCIS to Moodle:\n\n1. **Internal** (Make a copy of the file)\n\n   In this case the file is copied from oCIS and stored within the Moodle file system.\n2. **Reference**: (Link to the file) :construction: *This feature is not implemented yet* :woman_technologist:\n\n   In this case a public link of the file is created in oCIS and Moodle stores this link\n3. **Controlled Link**: (Create an access controlled link to the file) :construction: *This feature is not implemented yet* :man_technologist:\n\n\n   For this to work a special oCIS account needs to be connected to Moodle that will be used as a System account. If the user selects the \"Controlled Link\" option, the file will be shared to the System account and Moodle will access it through the System account.\n\n## Screenshots\n\n![file-picker-main.png](docs%2Ffile-picker-main.png)\n\n![file-picker-list.png](docs%2Ffile-picker-list.png)\n\n![file-picker-images.png](docs%2Ffile-picker-images.png)\n\n\n## Installation\n1. TLS certificate\n   The TLS certificates of oCIS need to be trusted by the server running moodle. If your oCIS instance has already a trusted certificate you can skip this step. \n   If you are using self-signed certificates you need to copy them to the moodle server and make it trust them. e.g. on Debian based systems to run oCIS on `https://host.docker.internal:9200`:\n   1. create a TLS certificate\n      ```bash\n      openssl req -x509  -newkey rsa:2048 -keyout ocis.pem -out ocis.crt -nodes -days 365 -subj '/CN=host.docker.internal'\n      ```\n   2. make 'host.docker.internal' resolve to the IP 127.0.0.1 on the docker host machine\n      ```bash\n      sudo sh -c \"echo '127.0.0.1 host.docker.internal' \u003e\u003e /etc/hosts\"\n      ```\n2. Install moodle and this plugin\n    - Development environment with docker:\n      ```bash\n      # get moodle from git\n      git clone https://github.com/moodle/moodle.git --branch MOODLE_402_STABLE --single-branch --depth=1\n      # get and install this plugin including it's dependencies\n      cd moodle/repository/\n      git clone https://github.com/owncloud/moodle-repository_ocis.git ocis\n      # get docker containers for moodle developers\n      cd ../../\n      git clone https://github.com/moodlehq/moodle-docker.git\n      cd moodle-docker\n      # some general settings for moodle\n      export MOODLE_DOCKER_WWWROOT=\u003cpath-of-your-moodle-source-code\u003e\n      export MOODLE_DOCKER_DB=pgsql\n      export MOODLE_DOCKER_PHP_VERSION=8.1\n      cp config.docker-template.php $MOODLE_DOCKER_WWWROOT/config.php\n      # disable some security settings, that would block access to non standard ports and local addresses\n      # !DON'T DO THAT FOR PRODUCTION INSTALLATIONS!\n      sed -i \"s|require_once(__DIR__ . '/lib/setup.php');|\\$CFG-\u003ecurlsecurityblockedhosts = '';\\n\\$CFG-\u003ecurlsecurityallowedport = '';\\n\\$CFG-\u003ebehat_extraallowedsettings = ['curlsecurityblockedhosts', 'curlsecurityallowedport'];\\nrequire_once(__DIR__ . '/lib/setup.php');|\" $MOODLE_DOCKER_WWWROOT/config.php\n      # allow container to access docker host via 'host.docker.internal'\n      cat \u003e local.yml \u003c\u003c'EOF'\n      services:\n        webserver:\n          extra_hosts:\n            - host.docker.internal:host-gateway\n          environment:\n            MOODLE_OCIS_URL: \"https://host.docker.internal:9200\" # optional, used to create OAuth 2 services and repository instance during installation\n            MOODLE_OCIS_CLIENT_ID: \"xdXOt13JKxym1B1QcEncf2XDkLAexMBFwiT9j6EfhhHFJhs2KM9jbjTmf8JBXE69\"  # optional, used to create OAuth 2 services and repository instance during installation\n            MOODLE_OCIS_CLIENT_SECRET: \"UBntmLjC2yYCeHwsyj73Uwo9TAaecAetRwMw0xYcvNL9yRdLSUi0hUAHfvCHFeFh\" # optional, used to create OAuth 2 services and repository instance during installation\n      EOF\n      # run moodle\n      bin/moodle-docker-compose up -d\n      # if oCIS will run with a self signed certificate copy that into the moodle container and make it trust it\n      bin/moodle-docker-compose cp \u003c/path/of/ocis.crt\u003e webserver:/usr/local/share/ca-certificates/\n      bin/moodle-docker-compose exec webserver update-ca-certificates\n      bin/moodle-docker-wait-for-db\n      bin/moodle-docker-compose exec webserver php admin/cli/install_database.php --agree-license --fullname=\"Docker moodle\" --shortname=\"docker_moodle\" --summary=\"Docker moodle site\" --adminpass=\"admin\" --adminemail=\"admin@example.com\"\n      ```\n      moodle will now be available under http://localhost:8000\n    - Other installation methods (require to [install and run moodle](https://docs.moodle.org/402/en/Installing_Moodle) first):\n        - Install the plugin using git:\n          - Clone the code of this repository into the `repository/ocis` folder of your moodle installation:\n            ```bash\n            git clone https://github.com/owncloud/moodle-repository_ocis.git \u003cmoodle-path\u003e/repository/ocis\n            ```\n          - Checkout the wanted version:\n            ```bash\n            cd \u003cmoodle-path\u003e/repository/ocis\n            git checkout v\u003cthe-required-version-of-the-plugin\u003e\n            ```\n        - Install the plugin using a downloaded ZIP file:\n            - Download the ZIP file of the last release [from GitHub](https://github.com/owncloud/moodle-repository_ocis/tags)\n            - In your moodle installation login as administrator \n            - Navigate to the \"Plugin installer\" (Site administration -\u003e Plugins -\u003e Install plugins)\n            - Upload the ZIP package of the plugin\n            - Click the `Install plugin from the ZIP file` button\n3. Install \u0026 run [oCIS](https://doc.owncloud.com/ocis/next/quickguide/quickguide.html)\n   If you have created an own TLS certificate in point 1, run oCIS using this certificate: \n   ```bash\n   OCIS_INSECURE=true \\\n   PROXY_HTTP_ADDR=0.0.0.0:9200 \\\n   OCIS_URL=https://host.docker.internal:9200 \\\n   PROXY_TRANSPORT_TLS_KEY=\u003c/path/of/ocis.pem\u003e \\\n   PROXY_TRANSPORT_TLS_CERT=\u003c/path/of/ocis.crt\u003e \\\n   ./ocis server\n   ```\n   :exclamation: Having set `OCIS_INSECURE=true` is not recommended for production use! :exclamation:\n4. Login to moodle as \"admin\"\n5. If you run oCIS on `localhost` or any local IP address go to the \"HTTP security\" page (\"Site administration\" \u003e \"General\" \u003e \"Security\" \u003e \"HTTP security\") and delete the IP address and host-name you are using from the \"cURL blocked hosts list\" list. E.g if you have been following the examples above and using `https://host.docker.internal:9200` as the address for oCIS, you will have to delete `172.16.0.0/12` from the list. \n6. If you run oCIS on any port other than `443` go to the \"HTTP security\" page (\"Site administration\" \u003e \"General\" \u003e \"Security\" \u003e \"HTTP security\") and add the port you are using to the \"cURL allowed ports list\" list. E.g. if you have been following the examples above add `9200` to the list.\n7. Go to the \"OAuth 2 services\" page (\"Site administration\" \u003e \"Server\" \u003e\"Server\" \u003e \"OAuth 2 services\")\n8. Create a new \"Custom\" service\n   1. Choose any name you like\n   2. Set \"Client ID\".\n      If moodle runs on `localhost` the ID `xdXOt13JKxym1B1QcEncf2XDkLAexMBFwiT9j6EfhhHFJhs2KM9jbjTmf8JBXE69` can be used for testing, else another client need to be set up in the [oCIS IDP](https://owncloud.dev/services/idp/configuration/)\n   3. Set \"Client secret\"\n      If moodle runs on `localhost` the secret `UBntmLjC2yYCeHwsyj73Uwo9TAaecAetRwMw0xYcvNL9yRdLSUi0hUAHfvCHFeFh` can be used for testing, else another client need to be set up in the [oCIS IDP](https://owncloud.dev/services/idp/configuration/)\n   4. Set \"Service base URL\" to the URL of your oCIS instance. An instance with a trusted TLS certificate is required, e.g. `https://host.docker.internal:9200`\n   5. Set \"Scopes included in a login request for offline access.\" to `openid offline_access email profile`\n   6. Save the changes\n9. To use webfinger for discovery of the oCIS server that is assigned to a specific user:\n    1. Click on the \"Configure endpoints\" icon of the newly created service\n    2. Create a new endpoint with the name `webfinger_endpoint` and the webfinger URL e.g. `\u003cservice-base-url\u003e/.well-known/webfinger`\n10. Go to the \"Manage repositories\" page (\"Site administration\" \u003e \"Plugins\" \u003e \"Repositories\" \u003e \"ownCloud Infinite Scale repository\")\n11. Create a new repository instance\n12. Choose a name you like\n13. Select the Oauth2 service you created before\n14. Save the settings\n15. Navigate to any page where there is a file picker e.g. \"My courses\" \u003e \"Create course\" \u003e \"Course image\"\n16. \"Add\" a new file\n17. Select the repository you have created earlier\n18. Click \"Login in to your account\"\n19. Go through the login / oauth process\n20. Now you should be able to see the content of your personal space and select files from there\n\n\n## Development\n\n:exclamation: If extra dependencies were installed for development, make sure not to commit them to the repository! :exclamation:\n\n### Auto-provisioning\n\nTo reduce the setup steps specially when doing development and running automated tests these environment variables can be set to auto-provision the plugin:\n\n- `MOODLE_OCIS_URL`, `MOODLE_OCIS_CLIENT_ID`, `MOODLE_OCIS_CLIENT_SECRET`, `MOODLE_OCIS_LOGO_URL` to create OAuth 2 services and repository instance during installation. Note: the auto-provisioning will be triggered only if all of `MOODLE_OCIS_URL`, `MOODLE_OCIS_CLIENT_ID`, `MOODLE_OCIS_CLIENT_SECRET` variables are set.\n\n### Run tests\n\n#### Style check\nTo meet the [moodle coding style](https://moodledev.io/general/development/policies/codingstyle), we are using phpcs with the [moodle ruleset](https://moodledev.io/general/development/tools/phpcs).\n```bash\nmake test-php-style\nmake test-php-style-fix\n```\n#### UI Tests\nAdditional setup for [UI TEST](tests/README.md)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowncloud%2Fmoodle-repository_ocis","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fowncloud%2Fmoodle-repository_ocis","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fowncloud%2Fmoodle-repository_ocis/lists"}