Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions cedar-example-use-cases/streaming_service/policies.cedar
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,7 @@ unless
context.now.localTimeOffset
)
.toTime
(
) &&
() &&
Comment on lines 78 to +79

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we get .toTime() here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This turns out to be difficult because of how we the Member CST node represents a call as vec [Field("toTime"), Call([])], so we'd have to write some slightly complex logic looking at the whole Member vec instead of just tweaking the formatting for an individual MemAccess

context.now.datetime.offset(context.now.localTimeOffset).toTime() <= duration(
"21h"
)
Expand Down
32 changes: 8 additions & 24 deletions cedar-example-use-cases/tags_n_roles/policies.cedar
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,15 @@ when
resource.tags has production_status
then
principal.allowedTagsForRole
[
"Role-A"
]
["Role-A"]
.production_status
.contains
(
"ALL"
) ||
resource.tags.production_status.contains("ALL") ||
principal.allowedTagsForRole
[
"Role-A"
]
["Role-A"]
.production_status
.containsAll
(
Expand All @@ -51,9 +47,7 @@ when
principal.allowedTagsForRole["Role-A"].country.contains("ALL") ||
resource.tags.country.contains("ALL") ||
principal.allowedTagsForRole
[
"Role-A"
]
["Role-A"]
.country
.containsAll
(
Expand All @@ -77,9 +71,7 @@ when
principal.allowedTagsForRole["Role-A"].stage.contains("ALL") ||
resource.tags.stage.contains("ALL") ||
principal.allowedTagsForRole
[
"Role-A"
]
["Role-A"]
.stage
.containsAll
(
Expand Down Expand Up @@ -108,19 +100,15 @@ when
resource.tags has production_status
then
principal.allowedTagsForRole
[
"Role-B"
]
["Role-B"]
.production_status
.contains
(
"ALL"
) ||
resource.tags.production_status.contains("ALL") ||
principal.allowedTagsForRole
[
"Role-B"
]
["Role-B"]
.production_status
.containsAll
(
Expand All @@ -143,9 +131,7 @@ when
principal.allowedTagsForRole["Role-B"].country.contains("ALL") ||
resource.tags.country.contains("ALL") ||
principal.allowedTagsForRole
[
"Role-B"
]
["Role-B"]
.country
.containsAll
(
Expand All @@ -168,9 +154,7 @@ when
principal.allowedTagsForRole["Role-B"].stage.contains("ALL") ||
resource.tags.stage.contains("ALL") ||
principal.allowedTagsForRole
[
"Role-B"
]
["Role-B"]
.stage
.containsAll
(
Expand Down
11 changes: 5 additions & 6 deletions cedar-example-use-cases/tax_preparer/policies.cedar
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,11 @@ when
principal.assigned_orgs
.contains
(
{organization
:resource.owner.organization,
serviceline
:resource.serviceline,
location
:resource.location}
{
organization: resource.owner.organization,
serviceline: resource.serviceline,
location: resource.location
}
)
};

Expand Down
Loading