Skip to content

Commit

Permalink
rbac personal polciy
Browse files Browse the repository at this point in the history
  • Loading branch information
RS-labhub committed Jun 23, 2024
1 parent 5c91ad2 commit c15b969
Showing 1 changed file with 14 additions and 15 deletions.
29 changes: 14 additions & 15 deletions rbac.rego
Original file line number Diff line number Diff line change
@@ -1,40 +1,39 @@
default allow = false

allow {
input.role == "admin"
input.role == "rohansrma"
}

allow {
input.role == "moderator"
input.action == "create_post"
input.role == "purgerSpecial"
input.action == "delete_post"
}

allow {
input.role == "moderator"
input.action == "edit_post"
input.role == "purger"
input.action == "change_post"
input.post.author != input.user
}

allow {
input.role == "general_user"
input.action == "create_post"
input.post.author == input.user
input.role == "purger"
input.action == "can_post"
input.post.author != input.user
}

allow {
input.role == "general_user"
input.action == "read_post"
input.role == "some_user"
input.action == "create_post"
input.post.author == input.user
}

allow {
input.role == "general_user"
input.post.author == input.user
input.action == "delete_post"
input.post.author == input.user
input.role == "some_user"
input.action == "read_post"
}

allow {
input.role == "general_user"
input.role == "some_user"
input.post.author == input.user
input.action == "edit_post"
input.post.author == input.user
Expand Down

0 comments on commit c15b969

Please sign in to comment.