mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:07:31 +00:00
feat: port reduction (#323)
* 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
This commit is contained in:
73
internal/api/grpc/admin/org.go
Normal file
73
internal/api/grpc/admin/org.go
Normal file
@@ -0,0 +1,73 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/golang/protobuf/ptypes/empty"
|
||||
|
||||
"github.com/caos/zitadel/pkg/grpc/admin"
|
||||
)
|
||||
|
||||
func (s *Server) GetOrgByID(ctx context.Context, orgID *admin.OrgID) (_ *admin.Org, err error) {
|
||||
org, err := s.org.OrgByID(ctx, orgID.Id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orgFromModel(org), nil
|
||||
}
|
||||
|
||||
func (s *Server) SearchOrgs(ctx context.Context, request *admin.OrgSearchRequest) (_ *admin.OrgSearchResponse, err error) {
|
||||
result, err := s.org.SearchOrgs(ctx, orgSearchRequestToModel(request))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &admin.OrgSearchResponse{
|
||||
Result: orgViewsFromModel(result.Result),
|
||||
Limit: request.Limit,
|
||||
Offset: request.Offset,
|
||||
TotalResult: result.TotalResult,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) IsOrgUnique(ctx context.Context, request *admin.UniqueOrgRequest) (org *admin.UniqueOrgResponse, err error) {
|
||||
isUnique, err := s.org.IsOrgUnique(ctx, request.Name, request.Domain)
|
||||
|
||||
return &admin.UniqueOrgResponse{IsUnique: isUnique}, err
|
||||
}
|
||||
|
||||
func (s *Server) SetUpOrg(ctx context.Context, orgSetUp *admin.OrgSetUpRequest) (_ *admin.OrgSetUpResponse, err error) {
|
||||
setUp, err := s.org.SetUpOrg(ctx, setUpRequestToModel(orgSetUp))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return setUpOrgResponseFromModel(setUp), err
|
||||
}
|
||||
|
||||
func (s *Server) GetOrgIamPolicy(ctx context.Context, in *admin.OrgIamPolicyID) (_ *admin.OrgIamPolicy, err error) {
|
||||
policy, err := s.org.GetOrgIamPolicyByID(ctx, in.OrgId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orgIamPolicyFromModel(policy), err
|
||||
}
|
||||
|
||||
func (s *Server) CreateOrgIamPolicy(ctx context.Context, in *admin.OrgIamPolicyRequest) (_ *admin.OrgIamPolicy, err error) {
|
||||
policy, err := s.org.CreateOrgIamPolicy(ctx, orgIamPolicyRequestToModel(in))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orgIamPolicyFromModel(policy), err
|
||||
}
|
||||
|
||||
func (s *Server) UpdateOrgIamPolicy(ctx context.Context, in *admin.OrgIamPolicyRequest) (_ *admin.OrgIamPolicy, err error) {
|
||||
policy, err := s.org.ChangeOrgIamPolicy(ctx, orgIamPolicyRequestToModel(in))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return orgIamPolicyFromModel(policy), err
|
||||
}
|
||||
|
||||
func (s *Server) DeleteOrgIamPolicy(ctx context.Context, in *admin.OrgIamPolicyID) (_ *empty.Empty, err error) {
|
||||
err = s.org.RemoveOrgIamPolicy(ctx, in.OrgId)
|
||||
return &empty.Empty{}, err
|
||||
}
|
Reference in New Issue
Block a user