nolint:tparallel,paralleltest
(t *testing.T)
| 145 | |
| 146 | //nolint:tparallel,paralleltest |
| 147 | func TestChatACLDisabled(t *testing.T) { |
| 148 | uid := uuid.NewString() |
| 149 | gid := uuid.NewString() |
| 150 | |
| 151 | chat := Chat{ |
| 152 | ID: uuid.New(), |
| 153 | OrganizationID: uuid.New(), |
| 154 | OwnerID: uuid.New(), |
| 155 | UserACL: ChatACL{ |
| 156 | uid: ChatACLEntry{Permissions: []policy.Action{policy.ActionRead}}, |
| 157 | }, |
| 158 | GroupACL: ChatACL{ |
| 159 | gid: ChatACLEntry{Permissions: []policy.Action{policy.ActionRead}}, |
| 160 | }, |
| 161 | } |
| 162 | |
| 163 | t.Run("ACLsOmittedWhenDisabled", func(t *testing.T) { |
| 164 | rbac.SetChatACLDisabled(true) |
| 165 | t.Cleanup(func() { rbac.SetChatACLDisabled(false) }) |
| 166 | |
| 167 | obj := chat.RBACObject() |
| 168 | |
| 169 | require.Empty(t, obj.ACLUserList, "user ACLs should be empty when disabled") |
| 170 | require.Empty(t, obj.ACLGroupList, "group ACLs should be empty when disabled") |
| 171 | }) |
| 172 | |
| 173 | t.Run("ACLsIncludedWhenEnabled", func(t *testing.T) { |
| 174 | rbac.SetChatACLDisabled(false) |
| 175 | |
| 176 | obj := chat.RBACObject() |
| 177 | |
| 178 | require.NotEmpty(t, obj.ACLUserList, "user ACLs should be present when enabled") |
| 179 | require.NotEmpty(t, obj.ACLGroupList, "group ACLs should be present when enabled") |
| 180 | require.Contains(t, obj.ACLUserList, uid) |
| 181 | require.Contains(t, obj.ACLGroupList, gid) |
| 182 | }) |
| 183 | } |
| 184 | |
| 185 | //nolint:tparallel,paralleltest |
| 186 | func TestWorkspaceACLDisabled(t *testing.T) { |
nothing calls this directly
no test coverage detected