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 )
| 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. |
| 403 | func (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. |
no test coverage detected