zitadel/pkg/management/api/grpc/project_member.go
Silvan 3025ac577b
feat: org queries (#136)
* search orgs

* org by domain

* member spooler

* member

* get roles

* tests

* types duration

* use default func for renew

* correct database

* reorder migrations

* delete unused consts

* move get roles to internal

* use prepared org by domain

* implement org in other objects

* add eventstores
2020-05-26 16:46:16 +02:00

41 lines
1.3 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) {
response, err := s.project.SearchProjectMembers(ctx, projectMemberSearchRequestsToModel(in))
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
}