mirror of
https://github.com/zitadel/zitadel.git
synced 2025-07-16 03:48:35 +00:00

# Which Problems Are Solved This PR *partially* addresses #9450 . Specifically, it implements the resource based API for the apps. APIs for app keys ARE not part of this PR. # How the Problems Are Solved - `CreateApplication`, `PatchApplication` (update) and `RegenerateClientSecret` endpoints are now unique for all app types: API, SAML and OIDC apps. - All new endpoints have integration tests - All new endpoints are using permission checks V2 # Additional Changes - The `ListApplications` endpoint allows to do sorting (see protobuf for details) and filtering by app type (see protobuf). - SAML and OIDC update endpoint can now receive requests for partial updates # Additional Context Partially addresses #9450
38 lines
1.1 KiB
Go
38 lines
1.1 KiB
Go
package app
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zitadel/zitadel/internal/api/grpc/app/v2beta/convert"
|
|
filter "github.com/zitadel/zitadel/internal/api/grpc/filter/v2"
|
|
app "github.com/zitadel/zitadel/pkg/grpc/app/v2beta"
|
|
)
|
|
|
|
func (s *Server) GetApplication(ctx context.Context, req *app.GetApplicationRequest) (*app.GetApplicationResponse, error) {
|
|
res, err := s.query.AppByIDWithPermission(ctx, req.GetId(), false, s.checkPermission)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &app.GetApplicationResponse{
|
|
App: convert.AppToPb(res),
|
|
}, nil
|
|
}
|
|
|
|
func (s *Server) ListApplications(ctx context.Context, req *app.ListApplicationsRequest) (*app.ListApplicationsResponse, error) {
|
|
queries, err := convert.ListApplicationsRequestToModel(s.systemDefaults, req)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
res, err := s.query.SearchApps(ctx, queries, s.checkPermission)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &app.ListApplicationsResponse{
|
|
Applications: convert.AppsToPb(res.Apps),
|
|
Pagination: filter.QueryToPaginationPb(queries.SearchRequest, res.SearchResponse),
|
|
}, nil
|
|
}
|