mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 19:14:23 +00:00
5699fe80d5
* feat: check oidc compliance * fix: add tests * fix: add oidc config tests * fix: add oidc config tests user agent * fix: test oidc config compliance * fix: test oidc config compliance * fix: useragent implicit authmethod none * fix: merge master * feat: translate compliance problems * feat: check native app for custom url * fix: better compliance handling * fix: better compliance handling * feat: add odidc dev mode * fix: remove deprecated request fro management api * fix: oidc package version * fix: migration * fix: tests * fix: remove unused functions * fix: generate proto files * fix: native implicit and code none compliant * fix: create project * Update internal/project/model/oidc_config_test.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: tests * Update internal/project/model/oidc_config.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * Update internal/project/model/oidc_config.go Co-authored-by: Livio Amstutz <livio.a@gmail.com> * fix: tests Co-authored-by: Livio Amstutz <livio.a@gmail.com>
70 lines
2.3 KiB
Go
70 lines
2.3 KiB
Go
package management
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/golang/protobuf/ptypes/empty"
|
|
|
|
"github.com/caos/zitadel/internal/api/authz"
|
|
"github.com/caos/zitadel/pkg/grpc/management"
|
|
)
|
|
|
|
func (s *Server) SearchUserGrants(ctx context.Context, in *management.UserGrantSearchRequest) (*management.UserGrantSearchResponse, error) {
|
|
request := userGrantSearchRequestsToModel(in)
|
|
request.AppendMyOrgQuery(authz.GetCtxData(ctx).OrgID)
|
|
response, err := s.usergrant.SearchUserGrants(ctx, request)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return userGrantSearchResponseFromModel(response), nil
|
|
}
|
|
|
|
func (s *Server) UserGrantByID(ctx context.Context, request *management.UserGrantID) (*management.UserGrantView, error) {
|
|
user, err := s.usergrant.UserGrantByID(ctx, request.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return userGrantViewFromModel(user), nil
|
|
}
|
|
|
|
func (s *Server) CreateUserGrant(ctx context.Context, in *management.UserGrantCreate) (*management.UserGrant, error) {
|
|
user, err := s.usergrant.AddUserGrant(ctx, userGrantCreateToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return usergrantFromModel(user), nil
|
|
}
|
|
|
|
func (s *Server) UpdateUserGrant(ctx context.Context, in *management.UserGrantUpdate) (*management.UserGrant, error) {
|
|
user, err := s.usergrant.ChangeUserGrant(ctx, userGrantUpdateToModel(in))
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return usergrantFromModel(user), nil
|
|
}
|
|
|
|
func (s *Server) DeactivateUserGrant(ctx context.Context, in *management.UserGrantID) (*management.UserGrant, error) {
|
|
user, err := s.usergrant.DeactivateUserGrant(ctx, in.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return usergrantFromModel(user), nil
|
|
}
|
|
func (s *Server) ReactivateUserGrant(ctx context.Context, in *management.UserGrantID) (*management.UserGrant, error) {
|
|
user, err := s.usergrant.ReactivateUserGrant(ctx, in.Id)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return usergrantFromModel(user), nil
|
|
}
|
|
|
|
func (s *Server) RemoveUserGrant(ctx context.Context, in *management.UserGrantID) (*empty.Empty, error) {
|
|
err := s.usergrant.RemoveUserGrant(ctx, in.Id)
|
|
return &empty.Empty{}, err
|
|
}
|
|
|
|
func (s *Server) BulkRemoveUserGrant(ctx context.Context, in *management.UserGrantRemoveBulk) (*empty.Empty, error) {
|
|
err := s.usergrant.BulkRemoveUserGrant(ctx, userGrantRemoveBulkToModel(in)...)
|
|
return &empty.Empty{}, err
|
|
}
|