Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add disable org on creation flag and disallow removing of last admin from the org/group #317

Merged
merged 4 commits into from
Sep 9, 2023

Conversation

Chief-Rishab
Copy link
Member

@Chief-Rishab Chief-Rishab commented Sep 1, 2023

  • Disable org on creation flag added.
  • Org APIs now accepts both org name and uuid. Have added checks to prevent actions on disabled orgs
  • Additionally a check to prevent the last org admin and project owner to be removed. Another user must be given these permissions before removing that user

@vercel
Copy link

vercel bot commented Sep 1, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
frontier ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 8, 2023 7:21pm

config/sample.config.yaml Outdated Show resolved Hide resolved
core/organization/service.go Outdated Show resolved Hide resolved
internal/api/v1beta1/domain.go Outdated Show resolved Hide resolved
pkg/server/config.go Outdated Show resolved Hide resolved
Copy link
Member

@kushsharma kushsharma left a comment

Choose a reason for hiding this comment

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

Left some minor comments rest LGTM

logger.Error(err.Error())
return nil, grpcInternalServerError
}
if len(owners) == 1 {
Copy link
Member

Choose a reason for hiding this comment

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

Hey where do we check the user we are trying to remove is part of owners list? This would fail the call if I am just removing a random user as well right if we have 1 owner?

}
}

owners, err := h.userService.ListByGroup(ctx, request.GetId(), schema.OwnerRelationName)
Copy link
Member

Choose a reason for hiding this comment

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

Have you tested this with schema.OwnerRelationName. I think we should check schema.DeletePermission instead to ensure he is the owner.

logger.Error(err.Error())
return nil, grpcInternalServerError
}
if len(admins) == 1 {
Copy link
Member

Choose a reason for hiding this comment

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

Same as groups, where do we check if the user being removed is actually admin?

@coveralls
Copy link

Pull Request Test Coverage Report for Build 6125621992

  • 203 of 333 (60.96%) changed or added relevant lines in 7 files are covered.
  • 26 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.3%) to 51.692%

Changes Missing Coverage Covered Lines Changed/Added Lines %
cmd/serve.go 0 1 0.0%
internal/api/v1beta1/domain.go 51 63 80.95%
internal/api/v1beta1/audit.go 12 32 37.5%
internal/api/v1beta1/group.go 85 112 75.89%
internal/api/v1beta1/org.go 41 71 57.75%
internal/api/v1beta1/invitations.go 12 52 23.08%
Files with Coverage Reduction New Missed Lines %
internal/api/v1beta1/org.go 8 77.37%
internal/api/v1beta1/domain.go 18 81.01%
Totals Coverage Status
Change from base Build 6121193618: -0.3%
Covered Lines: 6034
Relevant Lines: 11673

💛 - Coveralls

@kushsharma kushsharma merged commit 7c80c67 into main Sep 9, 2023
9 checks passed
@kushsharma kushsharma deleted the feat/disable-org-on-creation branch September 9, 2023 15:12
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.

3 participants