SMQ-2601 - Remove user from domain#3323
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3323 +/- ##
==========================================
+ Coverage 74.83% 80.87% +6.04%
==========================================
Files 160 105 -55
Lines 18890 13215 -5675
==========================================
- Hits 14136 10688 -3448
+ Misses 3904 1869 -2035
+ Partials 850 658 -192 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3ae195c to
20f24a7
Compare
| func (r ProvisionManageService) RemoveMemberFromDomain(ctx context.Context, domainID, memberID string) error { | ||
| switch r.entityType { | ||
| case policies.ClientType, | ||
| policies.ChannelType, | ||
| policies.GroupType: | ||
| role, err := r.repo.RetrieveRoleByDomainMember(ctx, domainID, memberID) | ||
| if err != nil { | ||
| return errors.Wrap(svcerr.ErrRemoveEntity, err) | ||
| } | ||
|
|
||
| pr := policies.Policy{ | ||
| ObjectType: policies.RoleType, | ||
| Object: role, | ||
| SubjectType: policies.UserType, | ||
| } | ||
|
|
||
| if err := r.policy.DeletePolicyFilter(ctx, pr); err != nil { | ||
| return errors.Wrap(svcerr.ErrDeletePolicies, err) | ||
| } | ||
|
|
||
| if err := r.repo.RemoveMemberFromDomain(ctx, domainID, memberID); err != nil { | ||
| return err | ||
| } | ||
| return nil | ||
| default: | ||
| return errInvalidOperation | ||
| } | ||
| } |
There was a problem hiding this comment.
This should be generic, so that it should work with MG
20f24a7 to
d340a32
Compare
|
|
||
| RemoveEntityMembers(ctx context.Context, session authn.Session, entityID string, members []string) (err error) | ||
|
|
||
| RemoveMemberFromDomain(ctx context.Context, domainID, memberID string) error |
There was a problem hiding this comment.
We could not have this RemoveMemberFromDomain because this have logic related to particular entity domain.
We should handle this via Entity Event Consumers ( for example in clients, channels, groups service , where it consumes domain delete event)
0113d25 to
2a2f384
Compare
2a2f384 to
16fd2fb
Compare
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
16fd2fb to
0ff4e4e
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3323 +/- ##
===========================================
+ Coverage 21.34% 71.45% +50.11%
===========================================
Files 147 153 +6
Lines 26244 21344 -4900
===========================================
+ Hits 5601 15252 +9651
+ Misses 20149 5147 -15002
- Partials 494 945 +451 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
What type of PR is this?
This is a feature because it enables a user to be removed from a domain
What does this do?
This pr:
Which issue(s) does this PR fix/relate to?
Have you included tests for your changes?
No
Did you document any new/modified feature?
No
Notes