Skip to content

[front] Chat permissions engine#2716

Ben requested to merge feat/chat-perms-m2716 into master

Ticket(s) / Related Merge Requests

Summary of Changes

Add permissions to create a chat room and upload media.

Testing Considerations

An on the fly change to specifications to better align with our business rules was made such that the only permissions added are:

  • CAN_CREATE_CHAT_ROOM
  • CAN_UPLOAD_CHAT_MEDIA

As we don't have media in chat yet, only the chat room creation permission is wired up.

Also note that you WILL have to refresh after changing permissions to see the effects.

E2E Failures are unrelated and will be handled in another MR.

Tenant
  • Permission can be toggled on and off as admin
  • When permission is off, I cannot create a NEW chat via "new chat" button at Chat screen.
  • When permission is off, I cannot create a NEW chat via "message" button on a users channel.
  • When permission is off, for a user whos channel I already have an active chat with, the message button will send me to the existing chat.
  • When permission is on, I can create a NEW chat via "new chat" button at Chat screen.
  • When permission is on, I can create a NEW chat via "message" button on a users channel.
Non-tenant
  • I can create a NEW chat via "new chat" button at Chat screen.
  • I can create a NEW chat via "message" button on a users channel.

Deployment Considerations

If you don't already have a script to do this, run the below to insert table rows for existing tenants to pick up the new permissions:

INSERT INTO minds_role_permissions (tenant_id, permission_id, role_id, enabled, created_at)
SELECT tenant_id, "CAN_CREATE_CHAT_ROOM", 0, 1, NOW()
FROM minds_tenants
WHERE root_user_guid IS NOT NULL
ON DUPLICATE KEY UPDATE enabled=true

INSERT INTO minds_role_permissions (tenant_id, permission_id, role_id, enabled, created_at)
SELECT tenant_id, "CAN_UPLOAD_CHAT_MEDIA", 0, 1, NOW()
FROM minds_tenants
WHERE root_user_guid IS NOT NULL
ON DUPLICATE KEY UPDATE enabled=true

Regression Scope

Adds new permissions, impacts chat creation.

Platform Affected (web, mobile, etc)

Web.

Developer Testing Completed

Manual, unit (phpspec), unit (jasmine/karma).

Screenshots / Screen Recording

Tenant

simplescreenrecorder-2024-04-09_17.09.56

simplescreenrecorder-2024-04-09_17.48.04

Non-tenant

simplescreenrecorder-2024-04-09_17.50.50

Does this impact

  • Localization
  • Dark/light mode
  • Guest mode

Definition of Done Checklist

  • The Acceptance Criteria has been met
  • Code is tested: Testing includes unit/spec, E2E/automated and manual testing
  • Merge requests description has been filled out
Edited by Ben

Merge request reports