Skip to content
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

Generate helpers in ServicePermissions #193

Merged
merged 3 commits into from
Mar 3, 2025
Merged
Changes from 1 commit
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
Prev Previous commit
Add IsAuditable
majst01 committed Mar 3, 2025
commit 2c22cb368c5514c5eff2b60208d80eff703ccc3e
7 changes: 6 additions & 1 deletion generate/go_servicepermissions.tpl
Original file line number Diff line number Diff line change
@@ -114,11 +114,16 @@ func IsProjectScope(req connect.AnyRequest) bool {
return ok
}

func IsChargeableScope(req connect.AnyRequest) bool {
func IsChargeable(req connect.AnyRequest) bool {
_, ok := GetServicePermissions().Chargeable[req.Spec().Procedure]
return ok
}

func IsAuditable(req connect.AnyRequest) bool {
_, ok := GetServicePermissions().Auditable[req.Spec().Procedure]
return ok
}

func GetTenantFromRequest(req connect.AnyRequest) (string, bool) {
if !IsTenantScope(req) {
return "", false
7 changes: 6 additions & 1 deletion go/permissions/servicepermissions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.