mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-13 19:44:21 +00:00
3549a8b64e
* move mgmt pkg * begin package restructure * rename auth package to authz * begin start api * move auth * move admin * fix merge * configs and interceptors * interceptor * revert generate-grpc.sh * some cleanups * console * move console * fix tests and merging * js linting * merge * merging and configs * change k8s base to current ports * fixes * cleanup * regenerate proto * remove unnecessary whitespace * missing param * go mod tidy * fix merging * move login pkg * cleanup * move api pkgs again * fix pkg naming * fix generate-static.sh for login * update workflow * fixes * logging * remove duplicate * comment for optional gateway interfaces * regenerate protos * fix proto imports for grpc web * protos * grpc web generate * grpc web generate * fix changes * add translation interceptor * fix merging * regenerate mgmt proto
44 lines
1.4 KiB
Go
44 lines
1.4 KiB
Go
package management
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
|
|
"github.com/caos/zitadel/pkg/grpc/management"
|
|
)
|
|
|
|
func (s *Server) GetOrgMemberRoles(ctx context.Context, _ *empty.Empty) (*management.OrgMemberRoles, error) {
|
|
return &management.OrgMemberRoles{Roles: s.org.GetOrgMemberRoles()}, nil
|
|
}
|
|
|
|
func (s *Server) SearchMyOrgMembers(ctx context.Context, in *management.OrgMemberSearchRequest) (*management.OrgMemberSearchResponse, error) {
|
|
members, err := s.org.SearchMyOrgMembers(ctx, orgMemberSearchRequestToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgMemberSearchResponseFromModel(members), nil
|
|
}
|
|
|
|
func (s *Server) AddMyOrgMember(ctx context.Context, member *management.AddOrgMemberRequest) (*management.OrgMember, error) {
|
|
addedMember, err := s.org.AddMyOrgMember(ctx, addOrgMemberToModel(member))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return orgMemberFromModel(addedMember), nil
|
|
}
|
|
|
|
func (s *Server) ChangeMyOrgMember(ctx context.Context, member *management.ChangeOrgMemberRequest) (*management.OrgMember, error) {
|
|
changedMember, err := s.org.ChangeMyOrgMember(ctx, changeOrgMemberToModel(member))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return orgMemberFromModel(changedMember), nil
|
|
}
|
|
|
|
func (s *Server) RemoveMyOrgMember(ctx context.Context, member *management.RemoveOrgMemberRequest) (*empty.Empty, error) {
|
|
err := s.org.RemoveMyOrgMember(ctx, member.UserId)
|
|
return &empty.Empty{}, err
|
|
}
|