UserSubject Assignment - Behavior and Configuration Guide
Overview
UserSubjectAssignment in Avni manages which users have access to which subjects (individuals, groups, and their members). This system ensures proper access control and sync behavior across the application.
Key Features
Automatic Member Assignment
When a group is assigned to a user, the system automatically creates individual assignments for all non-voided members of that group. This ensures users have access to both the group and its individual members without requiring separate manual assignments.
Smart Member Unassignment Constraints
The system prevents data inconsistency by not allowing users to unassign individual members if those members belong to a group that is still assigned to the same user. This maintains logical access control relationships.
Group Unassignment does not impact Members Assignment
When a Group Subject is unassigned, we do not automatically unassign all member subjects. User would have to manually unassign Members.
Catchment and Privilege constraints
Only those GroupSubjects and MemberSubjects will sync to User's device that have
- Its Address included in the User's Catchment
- One of the User's UserGroup Privilege should allow for View Privilege for those Subject Types
Configuration Details
Subject Type Configuration
- Only subjects marked as
isDirectlyAssignable=truecan be manually assigned - Groups can be assigned and will automatically include their members as of that moment on the server
- Individual members can also be assigned independently of their groups
Assignment Rules
- One user can be assigned to multiple subjects
- One subject can be assigned to multiple users
- All assignments must respect the user's designated catchment area
Database Structure
UserSubjectAssignmenttable: Tracks user-subject relationshipsGroupSubjecttable: Tracks group-member relationships- Both tables support soft deletion using the isVoided flag
Updated 5 days ago
