mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-06 13:07:52 +00:00
fix: remove manipulate metadata from authapi (#2303)
This commit is contained in:
parent
296f1c3c71
commit
1cd26d5b7d
@ -67,30 +67,6 @@ Returns the user sessions of the authorized user of the current useragent
|
||||
POST: /users/me/sessions/_search
|
||||
|
||||
|
||||
### SetMyMetadata
|
||||
|
||||
> **rpc** SetMyMetadata([SetMyMetadataRequest](#setmymetadatarequest))
|
||||
[SetMyMetadataResponse](#setmymetadataresponse)
|
||||
|
||||
Sets a user metadata by key to the authorized user
|
||||
|
||||
|
||||
|
||||
POST: /users/me/metadata/{key}
|
||||
|
||||
|
||||
### BulkSetMyMetadata
|
||||
|
||||
> **rpc** BulkSetMyMetadata([BulkSetMyMetadataRequest](#bulksetmymetadatarequest))
|
||||
[BulkSetMyMetadataResponse](#bulksetmymetadataresponse)
|
||||
|
||||
Set a list of user metadata to the authorized user
|
||||
|
||||
|
||||
|
||||
POST: /users/me/metadata/_bulk
|
||||
|
||||
|
||||
### ListMyMetadata
|
||||
|
||||
> **rpc** ListMyMetadata([ListMyMetadataRequest](#listmymetadatarequest))
|
||||
@ -115,30 +91,6 @@ Returns the user metadata by key of the authorized user
|
||||
GET: /users/me/metadata/{key}
|
||||
|
||||
|
||||
### RemoveMyMetadata
|
||||
|
||||
> **rpc** RemoveMyMetadata([RemoveMyMetadataRequest](#removemymetadatarequest))
|
||||
[RemoveMyMetadataResponse](#removemymetadataresponse)
|
||||
|
||||
Removes a user metadata by key to the authorized user
|
||||
|
||||
|
||||
|
||||
DELETE: /users/me/metadata/{key}
|
||||
|
||||
|
||||
### BulkRemoveMyMetadata
|
||||
|
||||
> **rpc** BulkRemoveMyMetadata([BulkRemoveMyMetadataRequest](#bulkremovemymetadatarequest))
|
||||
[BulkRemoveMyMetadataResponse](#bulkremovemymetadataresponse)
|
||||
|
||||
Set a list of user metadata to the authorized user
|
||||
|
||||
|
||||
|
||||
DELETE: /users/me/metadata/_bulk
|
||||
|
||||
|
||||
### ListMyRefreshTokens
|
||||
|
||||
> **rpc** ListMyRefreshTokens([ListMyRefreshTokensRequest](#listmyrefreshtokensrequest))
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
obj_grpc "github.com/caos/zitadel/internal/api/grpc/object"
|
||||
"github.com/caos/zitadel/internal/api/grpc/org"
|
||||
user_grpc "github.com/caos/zitadel/internal/api/grpc/user"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
"github.com/caos/zitadel/internal/eventstore/v1/models"
|
||||
grant_model "github.com/caos/zitadel/internal/usergrant/model"
|
||||
auth_pb "github.com/caos/zitadel/pkg/grpc/auth"
|
||||
@ -65,54 +64,6 @@ func (s *Server) GetMyMetadata(ctx context.Context, req *auth_pb.GetMyMetadataRe
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) SetMyMetadata(ctx context.Context, req *auth_pb.SetMyMetadataRequest) (*auth_pb.SetMyMetadataResponse, error) {
|
||||
ctxData := authz.GetCtxData(ctx)
|
||||
result, err := s.command.SetUserMetadata(ctx, &domain.Metadata{Key: req.Key, Value: req.Value}, ctxData.UserID, ctxData.ResourceOwner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &auth_pb.SetMyMetadataResponse{
|
||||
Details: obj_grpc.AddToDetailsPb(
|
||||
result.Sequence,
|
||||
result.ChangeDate,
|
||||
result.ResourceOwner,
|
||||
),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) BulkSetMyMetadata(ctx context.Context, req *auth_pb.BulkSetMyMetadataRequest) (*auth_pb.BulkSetMyMetadataResponse, error) {
|
||||
ctxData := authz.GetCtxData(ctx)
|
||||
result, err := s.command.BulkSetUserMetadata(ctx, ctxData.UserID, ctxData.ResourceOwner, BulkSetMetadataToDomain(req)...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &auth_pb.BulkSetMyMetadataResponse{
|
||||
Details: obj_grpc.DomainToChangeDetailsPb(result),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) RemoveMyMetadata(ctx context.Context, req *auth_pb.RemoveMyMetadataRequest) (*auth_pb.RemoveMyMetadataResponse, error) {
|
||||
ctxData := authz.GetCtxData(ctx)
|
||||
result, err := s.command.RemoveUserMetadata(ctx, req.Key, ctxData.UserID, ctxData.ResourceOwner)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &auth_pb.RemoveMyMetadataResponse{
|
||||
Details: obj_grpc.DomainToChangeDetailsPb(result),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) BulkRemoveMyMetadata(ctx context.Context, req *auth_pb.BulkRemoveMyMetadataRequest) (*auth_pb.BulkRemoveMyMetadataResponse, error) {
|
||||
ctxData := authz.GetCtxData(ctx)
|
||||
result, err := s.command.BulkRemoveUserMetadata(ctx, ctxData.UserID, ctxData.ResourceOwner, req.Keys...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &auth_pb.BulkRemoveMyMetadataResponse{
|
||||
Details: obj_grpc.DomainToChangeDetailsPb(result),
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *Server) ListMyUserSessions(ctx context.Context, req *auth_pb.ListMyUserSessionsRequest) (*auth_pb.ListMyUserSessionsResponse, error) {
|
||||
userSessions, err := s.repo.GetMyUserSessions(ctx)
|
||||
if err != nil {
|
||||
|
@ -97,30 +97,6 @@ service AuthService {
|
||||
};
|
||||
}
|
||||
|
||||
// Sets a user metadata by key to the authorized user
|
||||
rpc SetMyMetadata(SetMyMetadataRequest) returns (SetMyMetadataResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/users/me/metadata/{key}"
|
||||
body: "*"
|
||||
};
|
||||
|
||||
option (zitadel.v1.auth_option) = {
|
||||
permission: "authenticated"
|
||||
};
|
||||
}
|
||||
|
||||
// Set a list of user metadata to the authorized user
|
||||
rpc BulkSetMyMetadata(BulkSetMyMetadataRequest) returns (BulkSetMyMetadataResponse) {
|
||||
option (google.api.http) = {
|
||||
post: "/users/me/metadata/_bulk"
|
||||
body: "*"
|
||||
};
|
||||
|
||||
option (zitadel.v1.auth_option) = {
|
||||
permission: "authenticated"
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the user metadata of the authorized user
|
||||
rpc ListMyMetadata(ListMyMetadataRequest) returns (ListMyMetadataResponse) {
|
||||
option (google.api.http) = {
|
||||
@ -144,29 +120,6 @@ service AuthService {
|
||||
};
|
||||
}
|
||||
|
||||
// Removes a user metadata by key to the authorized user
|
||||
rpc RemoveMyMetadata(RemoveMyMetadataRequest) returns (RemoveMyMetadataResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/users/me/metadata/{key}"
|
||||
};
|
||||
|
||||
option (zitadel.v1.auth_option) = {
|
||||
permission: "authenticated"
|
||||
};
|
||||
}
|
||||
|
||||
// Set a list of user metadata to the authorized user
|
||||
rpc BulkRemoveMyMetadata(BulkRemoveMyMetadataRequest) returns (BulkRemoveMyMetadataResponse) {
|
||||
option (google.api.http) = {
|
||||
delete: "/users/me/metadata/_bulk"
|
||||
body: "*"
|
||||
};
|
||||
|
||||
option (zitadel.v1.auth_option) = {
|
||||
permission: "authenticated"
|
||||
};
|
||||
}
|
||||
|
||||
// Returns the refresh tokens of the authorized user
|
||||
rpc ListMyRefreshTokens(ListMyRefreshTokensRequest) returns (ListMyRefreshTokensResponse) {
|
||||
option (google.api.http) = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user