mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-24 00:28:18 +00:00
43dc925f16
* fix: add iam roles to permissions * fix: show state initial on usersearch * fix: search project roles returns only roles of project * fix: add project member owner on project create * fix: create new object oon failed event * feat: parse error body on chat message * feat: remove comment
42 lines
1.4 KiB
Go
42 lines
1.4 KiB
Go
package grpc
|
|
|
|
import (
|
|
"context"
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
)
|
|
|
|
func (s *Server) GetProjectMemberRoles(ctx context.Context, _ *empty.Empty) (*ProjectMemberRoles, error) {
|
|
return &ProjectMemberRoles{Roles: s.project.GetProjectMemberRoles()}, nil
|
|
}
|
|
|
|
func (s *Server) SearchProjectMembers(ctx context.Context, in *ProjectMemberSearchRequest) (*ProjectMemberSearchResponse, error) {
|
|
request := projectMemberSearchRequestsToModel(in)
|
|
request.AppendProjectQuery(in.ProjectId)
|
|
response, err := s.project.SearchProjectMembers(ctx, request)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return projectMemberSearchResponseFromModel(response), nil
|
|
}
|
|
|
|
func (s *Server) AddProjectMember(ctx context.Context, in *ProjectMemberAdd) (*ProjectMember, error) {
|
|
member, err := s.project.AddProjectMember(ctx, projectMemberAddToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return projectMemberFromModel(member), nil
|
|
}
|
|
|
|
func (s *Server) ChangeProjectMember(ctx context.Context, in *ProjectMemberChange) (*ProjectMember, error) {
|
|
member, err := s.project.ChangeProjectMember(ctx, projectMemberChangeToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return projectMemberFromModel(member), nil
|
|
}
|
|
|
|
func (s *Server) RemoveProjectMember(ctx context.Context, in *ProjectMemberRemove) (*empty.Empty, error) {
|
|
err := s.project.RemoveProjectMember(ctx, in.Id, in.UserId)
|
|
return &empty.Empty{}, err
|
|
}
|