checkComputedAttribute constructs a CheckFunction that checks if a computed attribute permission check request is allowed or denied.
( request *base.PermissionCheckRequest, ca *base.ComputedAttribute, )
| 421 | // checkComputedAttribute constructs a CheckFunction that checks if a computed attribute |
| 422 | // permission check request is allowed or denied. |
| 423 | func (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. |
no test coverage detected