Skip to content

Commit

Permalink
NOISSUE - Fix assign user to domain error (#53)
Browse files Browse the repository at this point in the history
* fix domain error

Signed-off-by: Musilah <[email protected]>

* resolve comments

Signed-off-by: Musilah <[email protected]>

---------

Signed-off-by: Musilah <[email protected]>
Signed-off-by: Musilah <[email protected]>
Co-authored-by: Musilah <[email protected]>
  • Loading branch information
Musilah and Musilah authored Dec 25, 2023
1 parent 4c06c05 commit 22bf1a5
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions ui/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1969,7 +1969,7 @@ func (us *uiService) ListDomains(token string, page, limit uint64) ([]byte, erro

domainsPage, err := us.sdk.Domains(pgm, token)
if err != nil {
return []byte{}, err
return []byte{}, errors.Wrap(ErrFailedRetreive, err)
}

noOfPages := int(math.Ceil(float64(domainsPage.Total) / float64(limit)))
Expand Down Expand Up @@ -2020,12 +2020,12 @@ func (us *uiService) UpdateDomain(token string, domain sdk.Domain) error {
func (us *uiService) Domain(token, domainID string) ([]byte, error) {
domain, err := us.sdk.Domain(domainID, token)
if err != nil {
return []byte{}, err
return []byte{}, errors.Wrap(ErrFailedRetreive, err)
}

permissions, err := us.sdk.DomainPermissions(domainID, token)
if err != nil {
return []byte{}, err
return []byte{}, errors.Wrap(ErrFailedRetreive, err)
}

crumb := breadcrumb{
Expand Down Expand Up @@ -2072,11 +2072,19 @@ func (us *uiService) DisableDomain(token, domainID string) error {
}

func (us *uiService) AssignMember(token, orgID string, req sdk.UsersRelationRequest) error {
return us.sdk.AddUserToDomain(orgID, req, token)
if err := us.sdk.AddUserToDomain(orgID, req, token); err != nil {
return errors.Wrap(ErrFailedAssign, err)
}

return nil
}

func (us *uiService) UnassignMember(token, domainID string, req sdk.UsersRelationRequest) error {
return us.sdk.RemoveUserFromDomain(domainID, req, token)
if err := us.sdk.RemoveUserFromDomain(domainID, req, token); err != nil {
return errors.Wrap(ErrFailedUnassign, err)
}

return nil
}

func (us *uiService) ViewMember(token, userIdentity string) (b []byte, err error) {
Expand Down

0 comments on commit 22bf1a5

Please sign in to comment.