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

Method checkComputedUserSet

internal/engines/check.go:403–419  ·  view source on GitHub ↗

metadata to determine if the computed user set should be excluded from the result. checkComputedUserSet is a method of CheckEngine that checks permissions using the ComputedUserSet data structure. It returns a CheckFunction closure that performs the check.

(
	request *base.PermissionCheckRequest, // The request containing details about the permission to be checked
	cu *base.ComputedUserSet, // The computed user set containing user set information
)

Source from the content-addressed store, hash-verified

401// checkComputedUserSet is a method of CheckEngine that checks permissions using the
402// ComputedUserSet data structure. It returns a CheckFunction closure that performs the check.
403func (engine *CheckEngine) checkComputedUserSet(
404 request *base.PermissionCheckRequest, // The request containing details about the permission to be checked
405 cu *base.ComputedUserSet, // The computed user set containing user set information
406) CheckFunction {
407 // The returned CheckFunction invokes a permission check with a new request that is almost the same
408 // as the incoming request, but changes the Permission to be the relation defined in the computed user set.
409 // This is how the check "descends" into the computed user set to check permissions there.
410 return engine.invoke(&base.PermissionCheckRequest{
411 TenantId: request.GetTenantId(), // Tenant ID from the incoming request
412 Entity: request.GetEntity(), // Entity from the incoming request
413 Permission: cu.GetRelation(), // Permission is set to the relation defined in the computed user set
414 Subject: request.GetSubject(), // The subject from the incoming request
415 Metadata: request.GetMetadata(), // Metadata from the incoming request
416 Context: request.GetContext(),
417 Arguments: request.GetArguments(),
418 })
419}
420
421// checkComputedAttribute constructs a CheckFunction that checks if a computed attribute
422// permission check request is allowed or denied.

Callers 2

checkLeafMethod · 0.95
checkTupleToUserSetMethod · 0.95

Calls 8

invokeMethod · 0.95
GetTenantIdMethod · 0.45
GetEntityMethod · 0.45
GetRelationMethod · 0.45
GetSubjectMethod · 0.45
GetMetadataMethod · 0.45
GetContextMethod · 0.45
GetArgumentsMethod · 0.45

Tested by

no test coverage detected