Skip to content

SMQ-2601 - Remove user from domain#3323

Open
felixgateru wants to merge 3 commits intoabsmach:mainfrom
felixgateru:smq2601-remove-user
Open

SMQ-2601 - Remove user from domain#3323
felixgateru wants to merge 3 commits intoabsmach:mainfrom
felixgateru:smq2601-remove-user

Conversation

@felixgateru
Copy link
Contributor

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:

  • implements repo methods to delete all user roles

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

@codecov
Copy link

codecov bot commented Jan 26, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.87%. Comparing base (20bafe0) to head (2a2f384).

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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@felixgateru felixgateru force-pushed the smq2601-remove-user branch 2 times, most recently from 3ae195c to 20f24a7 Compare January 29, 2026 12:12
@felixgateru felixgateru marked this pull request as ready for review January 29, 2026 12:18
@felixgateru felixgateru requested a review from a team as a code owner January 29, 2026 12:18
Comment on lines 230 to 257
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
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be generic, so that it should work with MG


RemoveEntityMembers(ctx context.Context, session authn.Session, entityID string, members []string) (err error)

RemoveMemberFromDomain(ctx context.Context, domainID, memberID string) error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove user from domain

2 participants