{"id":21513922,"url":"https://github.com/datasektionen/pls","last_synced_at":"2025-04-09T19:42:03.356Z","repository":{"id":141452966,"uuid":"63456407","full_name":"datasektionen/pls","owner":"datasektionen","description":"Permissions, pls. (third time's the charm)","archived":false,"fork":false,"pushed_at":"2025-01-23T19:37:51.000Z","size":106,"stargazers_count":1,"open_issues_count":6,"forks_count":4,"subscribers_count":30,"default_branch":"master","last_synced_at":"2025-03-23T21:35:53.567Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pls.datasektionen.se","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datasektionen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"publiccode":null,"codemeta":null}},"created_at":"2016-07-15T23:30:33.000Z","updated_at":"2025-01-23T19:37:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"d95fc5bb-a677-4bb1-8c9a-052bbc80fda8","html_url":"https://github.com/datasektionen/pls","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasektionen%2Fpls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasektionen%2Fpls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasektionen%2Fpls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datasektionen%2Fpls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datasektionen","download_url":"https://codeload.github.com/datasektionen/pls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248100903,"owners_count":21047870,"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":"2024-11-23T23:37:01.263Z","updated_at":"2025-04-09T19:42:03.317Z","avatar_url":"https://github.com/datasektionen.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pls\n\n## Setup (Docker)\n\nEasiest way to run the project is to use Docker. Assuming you have\n`docker` and `docker-compose` installed, you can run the following\ncommands.\n\n```bash\ndocker-compose build\ndocker-compose up\n```\n\nThis sets up a database, a local login instance, and a Pls instance.\nThen you can access the server at `http://localhost:4000`.\n\n## Setup (Local)\n\nWithout docker you will need a separate postgres database and\nan up-to-date [elixir installation](https://elixir-lang.org/install.html).\nYou will also need a valid API key to [login](https://github.com/datasektionen/login), or run your own instance of [nyckeln-under-dörrmattan](https://github.com/datasektionen/nyckeln-under-dorrmattan).\n\n## Database\n\nTo initialize the database run the mix tasks\n\n```bash\nmix ecto.create\nmix ecto.migrate\n# Optional: seed the database with some test data\nmix run priv/repo/seeds.exs\n```\n\n## Server\n\nTo start the server run\n\n```bash\nmix run --no-halt\n```\n\nTo enter an interactive elixir shell and start the server run\n\n```bash\niex -S mix\n```\n\nFrom there you can use the methods defined in Pls.Queries to edit the\ndatabase. There are some hard-coded permissions that you need to have\nin order to make changes to the database.\n\nMost likely you would want to add these as a default, so\nthat you can later use the frontend to make changes. Replace\n`\u003ckth-id\u003e` with your kth-id.\n\n```elixir\nPls.Queries.Group.add_permission(\"pls\", \"pls\")\nPls.Queries.User.add_membership(\"\u003ckth-id\u003e\", \"pls\", \"2050-01-01\")\n```\n\n## Endpoints\n\nPOST/DELETE always requires a valid login token as part of the request\nbody. The token needs to be a valid active token from login.\n\n```\n/                                   \u003c-- Fancy admin frontend\n\n/api/user\n/api/user/:uid\n/api/user/:uid/:group               # Accepts POST/DELETE requests. an expiry date is required when posting\n/api/user/:uid/:group/:permission\n\n/api/group\n/api/group/:name                    # Accepts POST/DELETE requests\n/api/group/:name/:permission        # Accepts POST/DELETE requests\n\n/api/mandate/:name                  # Name is email as defined by dfunkt.\n/api/mandate/:name/:group           # Accepts POST/DELETE\n\n/api/token/:token/:system\n/api/token/:token/:system/:permission\n\n/api/token/:tag/:group              # Accepts POST/DELETE\n```\n\n## Dependencies\n\nThis service depends on [login](https://github.com/datasektionen/login)\nand [dfunkt](https://github.com/datasektionen/dfunkt/).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatasektionen%2Fpls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatasektionen%2Fpls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatasektionen%2Fpls/lists"}