{"id":18715142,"url":"https://github.com/cerbos/demo-python","last_synced_at":"2025-04-12T13:07:37.355Z","repository":{"id":40511094,"uuid":"357876450","full_name":"cerbos/demo-python","owner":"cerbos","description":"Demo of using Cerbos with Python to check access to a holiday request system.","archived":false,"fork":false,"pushed_at":"2024-05-02T09:15:58.000Z","size":65,"stargazers_count":4,"open_issues_count":0,"forks_count":5,"subscribers_count":16,"default_branch":"main","last_synced_at":"2024-05-02T22:12:57.356Z","etag":null,"topics":["access-control","cerbos","policy","python","security"],"latest_commit_sha":null,"homepage":"https://cerbos.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cerbos.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-04-14T11:13:56.000Z","updated_at":"2024-05-02T09:11:51.000Z","dependencies_parsed_at":"2024-05-02T10:32:45.599Z","dependency_job_id":"c714cce1-d4c3-48d7-8071-61f37a1ec56c","html_url":"https://github.com/cerbos/demo-python","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/cerbos%2Fdemo-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cerbos%2Fdemo-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cerbos%2Fdemo-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cerbos%2Fdemo-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cerbos","download_url":"https://codeload.github.com/cerbos/demo-python/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223518540,"owners_count":17158689,"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":["access-control","cerbos","policy","python","security"],"created_at":"2024-11-07T13:07:42.529Z","updated_at":"2024-11-07T13:07:43.014Z","avatar_url":"https://github.com/cerbos.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cerbos Python Demo\n\nThis project demonstrates how to work with [Cerbos](https://github.com/cerbos/cerbos) in Python projects.\n\nIt shows how Cerbos enforces access rules on a holiday request created by an employee named Harry.\n\n## Requirements\n- Minimum Python version supported by this demo is 3.10\n\n⚠️ If you're completely new to Cerbos make sure to check the _[How it works](https://cerbos.dev/how-it-works)_ videos!  ⚠️\n\n\n## Run the demo\n\nClone this repository:\n  ```shell\n  git clone https://github.com/cerbos/demo-python.git \n  cd demo-python\n  ```\n\nRun the following command to launch the demo:\n```shell\n./pw demo\n```\n\nThat's all!\n\nThe demo script (`main.py`) starts a new Cerbos container with the policies from the `policies` directory and sends requests for a set of different principals and resources to demonstrate how policy evaluation works.\n\nNow try deleting the `condition` block attached to the `direct_manager` derived role (line 23-28 in [derived_roles_1.yml](policies/derived_roles_1.yml)) and run the `./pw demo` command again.\n\nAmanda, who was previously disallowed from viewing or approving Harry’s leave requests should now be allowed to do those actions.\n\nDo you understand why?\n\nRead more about Cerbos on our comprehensive [documentation](https://docs.cerbos.dev) or join the friendly [Cerbos Slack Community](https://join.slack.com/t/cerboscommunity/shared_invite/zt-1qlny60no-E8jLaLZSu08_ZhzORQOEOA) to ask questions.\n\nFeel free to get creative and edit [policies](policies) to test how even more complex use-cases would turn out.\n\n## Demo Video\nWatch the demo with commentary:\n\u003ca href=\"https://www.loom.com/share/0425d8a075804d528185ad2ba30817b3\"\u003e\n    \u003cp\u003eCerbos Python Demo (GitHub) - Watch Video\u003c/p\u003e\n    \u003cimg style=\"max-width:300px;\" src=\"https://cdn.loom.com/sessions/thumbnails/0425d8a075804d528185ad2ba30817b3-with-play.gif\"\u003e\n  \u003c/a\u003e\n\n## Playground\nLaunch the policy from this demo in the playground. Play with it to see how Cerbos behaves.\n\u003cP\u003e\u003ca href=\"https://play.cerbos.dev/p/UWG3inHjwrFhqkv60dec623G9PoYlgJf\"\u003e\u003cimg src=\"https://github.com/cerbos/express-jwt-cerbos/blob/main/docs/launch.jpg\"\u003e\u003c/a\u003e\u003c/p\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcerbos%2Fdemo-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcerbos%2Fdemo-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcerbos%2Fdemo-python/lists"}