Skip to content

Commit

Permalink
Add in_group and has_attribute policy functions
Browse files Browse the repository at this point in the history
This PR adds two policy functions.

1. in_group checks whether an Abbey user's identity is within a group

2. has_attribute checks whether an Abbey user has a custom attribute with
a given value
  • Loading branch information
Koshroy-Abbey committed Nov 21, 2023
1 parent 1d49a15 commit 3d6d9b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/abbey/functions/has_attribute.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import future.keywords.if

has_attribute(name, value) := true if {
data.system.abbey.identities.directory_sync_users.custom_attributes[name] == value
}
7 changes: 7 additions & 0 deletions src/abbey/functions/in_group.rego
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import future.keywords.if
import future.keywords.in

in_group(group_name) := true if {
some group in data.system.abbey.group_memberships
group == group_name
}

0 comments on commit 3d6d9b8

Please sign in to comment.