FieldRestriction
Controls access to specific fields within data records, implementing column-level security that determines which attributes users can see, modify, or interact with regardless of their access to the parent record. This granular control is essential when users need access to records but shouldn't see all fields - for example, HR staff might access employee records but not see salary information, or customer service reps might view orders but not credit card details. Field restrictions support various protection levels: complete hiding (field doesn't exist), masking (showing '****' instead of values), redaction (showing partial data like last 4 digits), transformation (showing ranges instead of exact values), and read-only (visible but not editable). The entity handles field dependencies where restricting one field affects others, inheritance where child objects inherit parent field restrictions, and conditional restrictions based on field values or user context. It enables compliance with privacy regulations requiring data minimization, implements need-to-know principles for sensitive attributes, and supports dynamic schemas where different users see different views of the same data. Field restrictions can be temporary (hiding data during blackout periods), progressive (revealing more fields as trust increases), or contextual (showing fields only in certain workflows). This field-level security is crucial for multi-tenant SaaS applications, healthcare systems protecting patient data, and financial systems managing sensitive financial information.
Properties
| Property | Type | Mode | Description | Required |
|---|---|---|---|---|
| restrictionId | uuid | stored | Unique identifier for this field restriction | Required |
| resourceType | string | stored | Type of resource containing the field Example: | Required |
| fieldName | string | stored | Name of the field being restricted Example: | Required |
| fieldPath | string | stored | Full path for nested fields Example: | Optional |
| restrictionType | string | enum | Type of restriction applied Values: | Required |
| restrictionLevel | string | enum | Severity of restriction Values: | Optional |
| maskingPattern | string | stored | Pattern for masking values Example: | Optional |
| transformFunction | string | stored | Transformation to apply to field value Example: | Optional |
| appliesTo | string | stored | JSON criteria for who this restriction affects Example: | Required |
| exemptions | string | stored | JSON array of exemption conditions Example: | Optional |
| conditions | string | stored | JSON conditions for when restriction applies Example: | Optional |
| dependentFields | string | stored | JSON array of fields affected by this restriction Example: | Optional |
| inheritToChildren | boolean | stored | Whether child objects inherit this restriction | Optional |
| priority | integer | stored | Evaluation order for conflicting restrictions | Optional |
| dataClassification | string | stored | Classification of the protected field Example: | Optional |
| complianceRequirement | string | stored | Regulatory requirement for this restriction Example: | Optional |
| alternativeValue | string | stored | Value to show instead of restricted data Example: | Optional |
| visibilityRules | string | stored | JSON rules for field visibility Example: | Optional |
| auditAccess | boolean | stored | Whether to audit access attempts | Optional |
| notifyOnAccess | boolean | stored | Whether to notify when restricted field is accessed | Optional |
| temporalRestriction | string | stored | Time-based restriction rules Example: | Optional |
| encryptionRequired | boolean | stored | Whether field must be encrypted at rest | Optional |
| retentionPolicy | string | stored | Special retention rules for this field | Optional |
| isActive | boolean | stored | Whether this restriction is active | Optional |
| effectiveFrom | DateTime | stored | When restriction becomes effective | Optional |
| effectiveUntil | DateTime | stored | When restriction expires | Optional |
| createdBy | User | stored | Who created this restriction | Optional |
| createdAt | DateTime | stored | When restriction was created | Required |
| metadata | object | stored | Additional restriction configuration | Optional |
Examples
Example 1
{
"@type": "FieldRestriction",
"restrictionId": "restrict_salary_001",
"resourceType": "employee_profile",
"fieldName": "salary",
"fieldPath": "compensation.base_salary",
"restrictionType": "mask",
"restrictionLevel": "full",
"maskingPattern": "$***,***",
"appliesTo": "{\"roles\":[\"employee\",\"manager\"],\"clearance_level\":{\"$lt\":4}}",
"exemptions": "[{\"role\":\"hr_admin\"},{\"role\":\"payroll\"},{\"condition\":\"user.id == record.id\"}]",
"conditions": "{\"record.employment_status\":\"active\"}",
"dependentFields": "[\"total_compensation\",\"bonus_amount\",\"stock_options\"]",
"inheritToChildren": true,
"priority": 100,
"dataClassification": "highly_sensitive",
"complianceRequirement": "SOX compliance - salary confidentiality",
"alternativeValue": "Competitive salary",
"visibilityRules": "{\"show_exact_if\":\"user.role == 'compensation_analyst'\",\"show_range_if\":\"user.role == 'recruiter'\"}",
"auditAccess": true,
"notifyOnAccess": false,
"encryptionRequired": true,
"isActive": true,
"createdAt": "2024-01-01T00:00:00Z",
"metadata": {
"salary_bands_visible": true,
"show_percentile": true
}
}Example 2
{
"@type": "FieldRestriction",
"restrictionId": "restrict_ssn_002",
"resourceType": "customer_record",
"fieldName": "social_security_number",
"fieldPath": "personal_info.ssn",
"restrictionType": "redact",
"restrictionLevel": "partial",
"maskingPattern": "***-**-####",
"appliesTo": "{\"all_users\":true}",
"exemptions": "[{\"role\":\"compliance_officer\"},{\"permission\":\"view_full_ssn\"}]",
"conditions": "{\"context.purpose\":{\"$ne\":\"identity_verification\"}}",
"inheritToChildren": true,
"priority": 200,
"dataClassification": "pii_critical",
"complianceRequirement": "PCI DSS - PII Protection",
"alternativeValue": "Last 4: ####",
"auditAccess": true,
"notifyOnAccess": true,
"temporalRestriction": "{\"hide_after\":\"30_days\",\"require_reauth_after\":\"5_minutes\"}",
"encryptionRequired": true,
"retentionPolicy": "{\"delete_after\":\"7_years\",\"archive_after\":\"1_year\"}",
"isActive": true,
"effectiveFrom": "2024-01-01T00:00:00Z",
"createdAt": "2024-01-01T00:00:00Z",
"metadata": {
"pii_category": "government_id",
"requires_legal_basis": true
}
}