MCPcopy Create free account
hub / github.com/Permify/permify / checkComputedAttribute

Method checkComputedAttribute

internal/engines/check.go:423–441  ·  view source on GitHub ↗

checkComputedAttribute constructs a CheckFunction that checks if a computed attribute permission check request is allowed or denied.

(
	request *base.PermissionCheckRequest,
	ca *base.ComputedAttribute,
)

Source from the content-addressed store, hash-verified

421// checkComputedAttribute constructs a CheckFunction that checks if a computed attribute
422// permission check request is allowed or denied.
423func (engine *CheckEngine) checkComputedAttribute(
424 request *base.PermissionCheckRequest,
425 ca *base.ComputedAttribute,
426) CheckFunction {
427 // We're returning a function here - this is the CheckFunction.
428 // Instead of performing the check directly here, we're using the 'invoke' method.
429 // We pass a new PermissionCheckRequest to 'invoke', copying most of the fields
430 // from the original request, but replacing the 'Permission' with the computed
431 // attribute's name.
432 return engine.invoke(&base.PermissionCheckRequest{
433 TenantId: request.GetTenantId(),
434 Entity: request.GetEntity(),
435 Permission: ca.GetName(),
436 Subject: request.GetSubject(),
437 Metadata: request.GetMetadata(),
438 Context: request.GetContext(),
439 Arguments: request.GetArguments(),
440 })
441}
442
443// checkDirectAttribute constructs a CheckFunction that checks if a direct attribute
444// permission check request is allowed or denied.

Callers 1

checkLeafMethod · 0.95

Calls 8

invokeMethod · 0.95
GetNameMethod · 0.65
GetTenantIdMethod · 0.45
GetEntityMethod · 0.45
GetSubjectMethod · 0.45
GetMetadataMethod · 0.45
GetContextMethod · 0.45
GetArgumentsMethod · 0.45

Tested by

no test coverage detected