Gitops rbac (#2776)
* Added RBAC for Gitops Signed-off-by: SarthakJain26 <sarthak@chaosnative.com>
This commit is contained in:
parent
e10716d4ba
commit
fdce7b296c
|
|
@ -581,6 +581,7 @@ github.com/lithammer/dedent v1.1.0/go.mod h1:jrXYCQtgg0nJiN+StA2KgR7w6CiQNv9Fd/Z
|
|||
github.com/litmuschaos/chaos-operator v0.0.0-20210126054859-85bb0ad85bfa h1:lBEvg10ZPndmBUMtVaMRVCqeKnKYmjtRSg2SF4iTQ7o=
|
||||
github.com/litmuschaos/chaos-operator v0.0.0-20210126054859-85bb0ad85bfa/go.mod h1:Z2GpYjqXwFd8bx+kv58YEQFxynx1v9PMGCGTQFRVnFQ=
|
||||
github.com/litmuschaos/elves v0.0.0-20201107015738-552d74669e3c/go.mod h1:DsbHGNUq/78NZozWVVI9Q6eBei4I+JjlkkD5aibJ3MQ=
|
||||
github.com/litmuschaos/litmus v0.0.0-20210511090902-7597746efaf1 h1:2Y5+Q0RxfsrLjaiLFHk72eJ4gxGoh+AQbCMufDVUvGc=
|
||||
github.com/logrusorgru/aurora v0.0.0-20200102142835-e9ef32dff381/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4=
|
||||
github.com/lpabon/godbc v0.1.1/go.mod h1:Jo9QV0cf3U6jZABgiJ2skINAXb9j8m51r07g4KI92ZA=
|
||||
github.com/lucas-clemente/aes12 v0.0.0-20171027163421-cd47fb39b79f/go.mod h1:JpH9J1c9oX6otFSgdUHwUBUizmKlrMjxWnIAjff4m04=
|
||||
|
|
|
|||
|
|
@ -209,14 +209,26 @@ func (r *mutationResolver) GitopsNotifer(ctx context.Context, clusterInfo model.
|
|||
}
|
||||
|
||||
func (r *mutationResolver) EnableGitOps(ctx context.Context, config model.GitConfig) (bool, error) {
|
||||
err := validate.ValidateRole(ctx, config.ProjectID, []model.MemberRole{model.MemberRoleOwner}, usermanagement.AcceptedInvitation)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return gitOpsHandler.EnableGitOpsHandler(ctx, config)
|
||||
}
|
||||
|
||||
func (r *mutationResolver) DisableGitOps(ctx context.Context, projectID string) (bool, error) {
|
||||
err := validate.ValidateRole(ctx, projectID, []model.MemberRole{model.MemberRoleOwner}, usermanagement.AcceptedInvitation)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return gitOpsHandler.DisableGitOpsHandler(ctx, projectID)
|
||||
}
|
||||
|
||||
func (r *mutationResolver) UpdateGitOps(ctx context.Context, config model.GitConfig) (bool, error) {
|
||||
err := validate.ValidateRole(ctx, config.ProjectID, []model.MemberRole{model.MemberRoleOwner}, usermanagement.AcceptedInvitation)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return gitOpsHandler.UpdateGitOpsDetailsHandler(ctx, config)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,6 @@ var (
|
|||
backgroundContext = context.Background()
|
||||
)
|
||||
|
||||
// TODO add projectID and user permission validation
|
||||
// EnableGitOpsHandler enables gitops for a particular project
|
||||
func EnableGitOpsHandler(ctx context.Context, config model.GitConfig) (bool, error) {
|
||||
gitLock.Lock(config.ProjectID, nil)
|
||||
|
|
|
|||
Loading…
Reference in New Issue