mirror of
https://github.com/zitadel/zitadel.git
synced 2025-04-26 01:10:50 +00:00

* fix: import user * fix: label policy * fix: label policy * fix: label policy * fix: migrations * fix: migrations * fix: migrations * fix: label policy * loginSuffix in login ui * suffix * fix cursor on disabled user selection Co-authored-by: Livio Amstutz <livio.a@gmail.com>
46 lines
1.3 KiB
Go
46 lines
1.3 KiB
Go
package management
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/caos/zitadel/pkg/grpc/management"
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
)
|
|
|
|
func (s *Server) GetLabelPolicy(ctx context.Context, _ *empty.Empty) (*management.LabelPolicyView, error) {
|
|
result, err := s.org.GetLabelPolicy(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return labelPolicyViewFromModel(result), nil
|
|
}
|
|
|
|
func (s *Server) GetDefaultLabelPolicy(ctx context.Context, _ *empty.Empty) (*management.LabelPolicyView, error) {
|
|
result, err := s.org.GetLabelPolicy(ctx)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return labelPolicyViewFromModel(result), nil
|
|
}
|
|
|
|
func (s *Server) CreateLabelPolicy(ctx context.Context, policy *management.LabelPolicyRequest) (*management.LabelPolicy, error) {
|
|
result, err := s.org.AddLabelPolicy(ctx, labelPolicyRequestToModel(policy))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return labelPolicyFromModel(result), nil
|
|
}
|
|
|
|
func (s *Server) UpdateLabelPolicy(ctx context.Context, policy *management.LabelPolicyRequest) (*management.LabelPolicy, error) {
|
|
result, err := s.org.ChangeLabelPolicy(ctx, labelPolicyRequestToModel(policy))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return labelPolicyFromModel(result), nil
|
|
}
|
|
|
|
func (s *Server) RemoveLabelPolicy(ctx context.Context, _ *empty.Empty) (*empty.Empty, error) {
|
|
err := s.org.RemoveLabelPolicy(ctx)
|
|
return &empty.Empty{}, err
|
|
}
|