-
Notifications
You must be signed in to change notification settings - Fork 41
Labels
domain:authSomething related to authSomething related to authplatform:backendBackend / cloud functionsBackend / cloud functionspriority:medium 👍Regular priority issueRegular priority issue
Milestone
Description
Description:
This issue focuses on implementing role management and validation for user documents in the tanam-documents
collection. The following tasks need to be accomplished:
-
Document ID Validation:
- Ensure that the document ID matches a Firebase Auth UID.
- Remove the document if the ID does not match any Firebase Auth UID.
-
Assign Admin Role:
- Automatically assign the
admin
role to the first document written in the collection.
- Automatically assign the
-
Role Enforcement:
- Include the role as part of the document.
- Enforce security rules to prevent unauthorized changes to the role field in the document.
-
Role Management:
- Set the role in custom claims when the role is changed in the document.
-
Role Removal:
- Remove the role from custom claims if a user document is deleted.
Acceptance Criteria:
- Document ID validation is implemented and documents with non-matching IDs are removed.
- The first document written in the collection is assigned the
admin
role. - Security rules are enforced to prevent changes to the role field.
- Custom claims are updated with the role when the role is changed in the document.
- Custom claims are cleared of roles when a user document is deleted.
Notes:
- Ensure robust error handling and logging for all operations.
- Security rules should be thoroughly tested to ensure compliance.
- Documentation should be updated to reflect these changes.
Metadata
Metadata
Assignees
Labels
domain:authSomething related to authSomething related to authplatform:backendBackend / cloud functionsBackend / cloud functionspriority:medium 👍Regular priority issueRegular priority issue
Type
Projects
Status
Done