ResourcePermission
Defines the permission model for different types of resources in the system, establishing what operations are possible on each resource type and how permissions are inherited, delegated, and combined. This entity acts as a template that describes all possible permissions for resource categories like 'documents', 'databases', or 'apis', serving as the blueprint for access control decisions. It defines not just CRUD operations but complex, resource-specific actions like 'publish', 'archive', 'approve', or 'rollback'. Each resource type can have its own permission hierarchy where having 'manage' permission might automatically grant 'write' and 'read'. The entity specifies ownership models (who gets what permissions when creating a resource), inheritance rules (how folder permissions flow to files), and aggregation patterns (how multiple permissions combine). It handles resource lifecycle permissions, defining who can transition resources between states like draft → review → published. The entity also defines permission dependencies (you need 'read' to have 'write'), mutual exclusions (can't have both 'approve' and 'submit'), and contextual variations (different permissions in different environments). This is essential for building flexible yet consistent authorization across diverse resource types while maintaining principle of least privilege. It enables features like temporary access elevation, permission templates for common scenarios, and automated permission assignment based on resource characteristics.
Properties
| Property | Type | Mode | Description | Required |
|---|---|---|---|---|
| permissionId | uuid | stored | Unique identifier for this resource permission | Required |
| resourceType | string | stored | Type of resource this permission applies to Example: | Required |
| permissionCode | string | stored | Unique code for this permission Example: | Required |
| permissionName | string | stored | Human-readable permission name Example: | Required |
| description | string | stored | Detailed explanation of what this permission allows Example: | Optional |
| operation | string | stored | The operation this permission enables Example: | Required |
| category | string | enum | Category of permission Values: | Required |
| riskLevel | string | enum | Risk assessment of granting this permission Values: | Optional |
| scope | string | enum | Scope of the permission Values: | Optional |
| impliedPermissions | string | stored | JSON array of permissions automatically included Example: | Optional |
| requiredPermissions | string | stored | JSON array of prerequisite permissions Example: | Optional |
| conflictingPermissions | string | stored | JSON array of mutually exclusive permissions Example: | Optional |
| parentPermission | ResourcePermission | stored | Parent permission in hierarchy | Optional |
| isInheritable | boolean | stored | Whether child resources inherit this permission | Optional |
| isDelegatable | boolean | stored | Whether holders can delegate this permission | Optional |
| isTransferable | boolean | stored | Whether permission can be transferred between users | Optional |
| requiresMfa | boolean | stored | Whether MFA is required to use this permission | Optional |
| requiresApproval | boolean | stored | Whether using this permission needs approval | Optional |
| approvalConfig | string | stored | JSON configuration for approval workflow | Optional |
| auditLevel | string | enum | Required audit level when permission is used Values: | Optional |
| validStates | string | stored | JSON array of resource states where permission applies Example: | Optional |
| fieldLevel | boolean | stored | Whether permission can be applied at field level | Optional |
| defaultOwnerGrant | boolean | stored | Whether resource owners get this permission by default | Optional |
| defaultCreatorGrant | boolean | stored | Whether resource creators get this permission by default | Optional |
| maxDelegationDepth | integer | stored | Maximum delegation chain length | Optional |
| timeRestrictions | string | stored | JSON time-based restrictions | Optional |
| usageQuota | integer | stored | Maximum uses per time period | Optional |
| quotaPeriod | string | stored | Time period for usage quota | Optional |
| isActive | boolean | stored | Whether this permission is currently available | Optional |
| isSystem | boolean | stored | Whether this is a system-defined permission | Optional |
| createdAt | DateTime | stored | When this permission was defined | Required |
| metadata | object | stored | Additional permission configuration | Optional |
Examples
Example 1
{
"@type": "ResourcePermission",
"permissionId": "perm_doc_publish",
"resourceType": "document",
"permissionCode": "document.publish",
"permissionName": "Publish Document",
"description": "Allows changing document state from draft/review to published, making it visible to all users with read access",
"operation": "publish",
"category": "workflow",
"riskLevel": "medium",
"scope": "own",
"impliedPermissions": "[\"document.read\",\"document.view_history\"]",
"requiredPermissions": "[\"document.write\",\"document.review\"]",
"conflictingPermissions": "[\"document.draft_only\"]",
"isInheritable": false,
"isDelegatable": true,
"isTransferable": false,
"requiresMfa": true,
"requiresApproval": true,
"approvalConfig": "{\"approvers\":[\"document_owner\",\"team_lead\"],\"timeout_hours\":48}",
"auditLevel": "detailed",
"validStates": "[\"review\",\"approved\"]",
"fieldLevel": false,
"defaultOwnerGrant": true,
"defaultCreatorGrant": false,
"maxDelegationDepth": 1,
"timeRestrictions": "{\"allowed_hours\":\"09:00-18:00\",\"allowed_days\":[\"mon\",\"tue\",\"wed\",\"thu\",\"fri\"]}",
"isActive": true,
"isSystem": true,
"createdAt": "2024-01-01T00:00:00Z",
"metadata": {
"workflow_step": "publish",
"notification_required": true
}
}Example 2
{
"@type": "ResourcePermission",
"permissionId": "perm_db_export",
"resourceType": "database",
"permissionCode": "database.export",
"permissionName": "Export Database",
"description": "Allows exporting entire database contents including schema and data",
"operation": "export",
"category": "admin",
"riskLevel": "critical",
"scope": "organization",
"impliedPermissions": "[\"database.read\",\"database.query\"]",
"requiredPermissions": "[\"database.admin\"]",
"conflictingPermissions": "[\"database.readonly\"]",
"isInheritable": false,
"isDelegatable": false,
"isTransferable": false,
"requiresMfa": true,
"requiresApproval": true,
"approvalConfig": "{\"approvers\":[\"dba\",\"security_team\"],\"timeout_hours\":24,\"emergency_bypass\":true}",
"auditLevel": "full",
"fieldLevel": false,
"defaultOwnerGrant": false,
"defaultCreatorGrant": false,
"maxDelegationDepth": 0,
"usageQuota": 5,
"quotaPeriod": "month",
"isActive": true,
"isSystem": true,
"createdAt": "2024-01-01T00:00:00Z",
"metadata": {
"compliance_check": "required",
"data_classification": "sensitive"
}
}