这是indexloc提供的服务,不要输入任何密码
Skip to content

Implement Role Management and Validation for User Documents #391

@DennisAlund

Description

@DennisAlund

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:

  1. 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.
  2. Assign Admin Role:

    • Automatically assign the admin role to the first document written in the collection.
  3. Role Enforcement:

    • Include the role as part of the document.
    • Enforce security rules to prevent unauthorized changes to the role field in the document.
  4. Role Management:

    • Set the role in custom claims when the role is changed in the document.
  5. 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

Type

No type

Projects

Status

Done

Relationships

None yet

Development

No branches or pull requests

Issue actions