-
Notifications
You must be signed in to change notification settings - Fork 58
Add LMS app template for fine-grained authorization #132
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
Open
Tabintel
wants to merge
36
commits into
permitio:main
Choose a base branch
from
Tabintel:add-lms-app-template
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
ca0ced3
Add LMS app template for fine-grained authorization
Tabintel df76bb5
Add LMS app template for fine-grained authorization
Tabintel 97b0b97
Add LMS app template for fine-grained authorization
Tabintel 26ce195
addresses the comments
Tabintel 5f9c37a
Add LMS app template for fine-grained authorization
Tabintel f2c0360
Add LMS app template for fine-grained authorization
Tabintel 22dd9a3
Add LMS app template for fine-grained authorization
Tabintel 5809796
Add LMS app template configuration
Tabintel 24384dc
Update .gitignore and remove unused README
Tabintel 24bb16e
Trino Schema Command
gemanor 1c732f7
Fix Tests
gemanor ef2ef6e
Fix CI Tests
gemanor 25dae3c
chore: add a RBAC blog template
Pradumnasaraf b95a587
feat: add roles and user sets for blog resource in RBAC configuration
Pradumnasaraf a524913
feat: add condition set rules and resource
Pradumnasaraf de4513e
chore: add condition set rules and resource sets for premium blog access
Pradumnasaraf 9f7304e
refactor: update blog resource configuration and roles for comment ma…
Pradumnasaraf f480453
refactor: reorganize permissions for blog and comment resources, and …
Pradumnasaraf 7c4b180
chore: add descriptions for blog and comment resources in Terraform t…
Pradumnasaraf bab5fb4
refactor: rename blog resources and roles to post for improved clarit…
Pradumnasaraf 3e00c89
refactor: update permissions for post admin role and remove unused co…
Pradumnasaraf c719f69
refactor: formatting
Pradumnasaraf b5a1a45
fix attributes assigned under wrong key
orweis c376723
New version
gemanor 1feca85
Adding support for EU region (#137)
EliMoshkovich 7c91c5e
Create gateway-api-authorization.tf
miracleonyenma 9122115
Add createColumnResources option to Trino configuration and update re…
danyi1212 6e6bd15
fix the publisher CI (#140)
EliMoshkovich 5ce3e01
add expense approval system terraform file
Taofiqq 11351e1
Add LMS app template configuration
Tabintel 20287e8
Update .gitignore and remove unused README
Tabintel adbc42b
Remove duplicate lmsapp.tf file
Tabintel 7afcb7b
Merge branch 'main' of https://github.com/Tabintel/permit-cli into ad…
Tabintel 9ced17a
updates
Tabintel ac6b51e
Merge branch 'add-lms-app-template' of https://github.com/Tabintel/pe…
Tabintel 436af9d
Update
Tabintel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| # LMS App Template | ||
| This template configures a Learning Management System (LMS) with resources (`course`, `enrollment`, `assignment`), roles (`student`, `teacher`, `teaching_assistant`, `admin`), and fine-grained policies (e.g., students read enrolled courses). | ||
|
|
||
| ## Usage | ||
| 1. Install the Permit CLI: `npm install -g @permitio/cli` | ||
| 2. Apply the template: `permit env template apply lms-app` | ||
| 3. Replace `{{API_KEY}}` in `main.tf` with your Permit API key. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,189 @@ | ||
| terraform { | ||
| required_providers { | ||
| permitio = { | ||
| source = "permitio/permit-io" | ||
| version = "~> 0.0.12" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should be same as other templates |
||
| } | ||
| } | ||
| } | ||
|
|
||
| provider "permitio" { | ||
| api_url = "https://api.permit.io" | ||
| api_key = "{{API_KEY}}" | ||
| } | ||
|
|
||
| # Resources | ||
| resource "permitio_resource" "Course" { | ||
| name = "Course" | ||
| description = "A course in the Learning Management System" | ||
| key = "Course" | ||
|
|
||
| actions = { | ||
| "create" = { | ||
| name = "create" | ||
| }, | ||
| "read" = { | ||
| name = "read" | ||
| }, | ||
| "update" = { | ||
| name = "update" | ||
| }, | ||
| "delete" = { | ||
| name = "delete" | ||
| }, | ||
| "enroll" = { | ||
| name = "enroll" | ||
| } | ||
| } | ||
| attributes = { | ||
| "enrolledStudents" = { | ||
| name = "Enrolled Students" | ||
| type = "array" | ||
| }, | ||
| "teacherId" = { | ||
| name = "Teacher ID" | ||
| type = "string" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| resource "permitio_resource" "Enrollment" { | ||
| name = "Enrollment" | ||
| description = "Student enrollment in a course" | ||
| key = "Enrollment" | ||
|
|
||
| actions = { | ||
| "create" = { | ||
| name = "create" | ||
| }, | ||
| "read" = { | ||
| name = "read" | ||
| }, | ||
| "delete" = { | ||
| name = "delete" | ||
| } | ||
| } | ||
| attributes = {} | ||
| } | ||
|
|
||
| resource "permitio_resource" "Assignment" { | ||
| name = "Assignment" | ||
| description = "An assignment linked to a course" | ||
| key = "Assignment" | ||
|
|
||
| actions = { | ||
| "create" = { | ||
| name = "create" | ||
| }, | ||
| "read" = { | ||
| name = "read" | ||
| }, | ||
| "update" = { | ||
| name = "update" | ||
| }, | ||
| "delete" = { | ||
| name = "delete" | ||
| }, | ||
| "grade" = { | ||
| name = "grade" | ||
| } | ||
| } | ||
| attributes = { | ||
| "dueDate" = { | ||
| name = "Due Date" | ||
| type = "string" | ||
| } | ||
| } | ||
| } | ||
|
|
||
| # Roles | ||
| resource "permitio_role" "Student" { | ||
| key = "student" | ||
| name = "Student" | ||
| permissions = ["Course:read", "Enrollment:create", "Assignment:read", "Assignment:submit"] | ||
|
|
||
| depends_on = [permitio_resource.Course, permitio_resource.Enrollment, permitio_resource.Assignment] | ||
| } | ||
|
|
||
| resource "permitio_role" "Teacher" { | ||
| key = "teacher" | ||
| name = "Teacher" | ||
| permissions = ["Course:create", "Course:read", "Course:update", "Course:delete", "Assignment:read", "Assignment:grade"] | ||
|
|
||
| depends_on = [permitio_resource.Course, permitio_resource.Assignment] | ||
| } | ||
|
|
||
| resource "permitio_role" "Teaching_Assistant" { | ||
| key = "teaching_assistant" | ||
| name = "Teaching Assistant" | ||
| permissions = ["Course:read", "Course:update", "Assignment:read"] | ||
|
|
||
| depends_on = [permitio_resource.Course, permitio_resource.Assignment] | ||
| } | ||
|
|
||
| resource "permitio_role" "Admin" { | ||
| key = "admin" | ||
| name = "Admin" | ||
| permissions = [ | ||
| "Course:create", "Course:read", "Course:update", "Course:delete", | ||
| "Enrollment:create", "Enrollment:read", "Enrollment:delete", | ||
| "Assignment:create", "Assignment:read", "Assignment:update", "Assignment:delete", "Assignment:grade" | ||
| ] | ||
|
|
||
| depends_on = [permitio_resource.Course, permitio_resource.Enrollment, permitio_resource.Assignment] | ||
| } | ||
|
|
||
| # Relations | ||
| resource "permitio_relation" "Course_Teacher" { | ||
| key = "assigned_to" | ||
| name = "Assigned To" | ||
| subject_resource = permitio_resource.Course.key | ||
| object_resource = permitio_resource.Teacher.key | ||
| depends_on = [ | ||
| permitio_resource.Course, | ||
| permitio_resource.Teacher | ||
| ] | ||
| } | ||
|
|
||
| # Resource Sets | ||
| resource "permitio_resource_set" "Enrolled_Course" { | ||
| name = "Enrolled Course" | ||
| key = "Enrolled_Course" | ||
| resource = permitio_resource.Course.key | ||
| conditions = jsonencode({ | ||
| "allOf": [ | ||
| { | ||
| "allOf": [ | ||
| { | ||
| "resource.enrolledStudents": { | ||
| "contains": "{{user_id}}" | ||
| } | ||
| } | ||
| ] | ||
| } | ||
| ] | ||
| }) | ||
| depends_on = [permitio_resource.Course] | ||
| } | ||
|
|
||
| # Role Derivations | ||
| resource "permitio_role_derivation" "Teacher_to_Course" { | ||
| role = permitio_role.Teacher.key | ||
| on_resource = permitio_resource.Course.key | ||
| to_role = permitio_role.Teacher.key | ||
| resource = permitio_resource.Course.key | ||
| linked_by = permitio_relation.Course_Teacher.key | ||
| depends_on = [ | ||
| permitio_role.Teacher, | ||
| permitio_resource.Course, | ||
| permitio_relation.Course_Teacher | ||
| ] | ||
| } | ||
|
|
||
| # Condition Set Rules | ||
| resource "permitio_condition_set_rule" "student_read_enrolled_course" { | ||
| user_set = "student" | ||
| resource_set = "Enrolled_Course" | ||
| permission = "Course:read" | ||
| depends_on = [permitio_role.Student, permitio_resource_set.Enrolled_Course] | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move it to the
source/templatefolder, and add the template description to the rootreadmefileAlso, revert the .gitignore