snapshot of https://github.com/cortezaproject/corteza.git (2024.9.x, 2026-09-18; blobs > 131072B omitted)
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
Some checks failed
SonarQube / SonarQube (push) Failing after 5m28s
E2e test on main branch push / server and client test (map[name:admin port:8080]) (push) Failing after 3m33s
Server and lib tests / Library test (js) (push) Failing after 1m36s
Server and lib tests / Library test (vue) (push) Successful in 2m24s
Server and lib tests / Web client test (admin) (push) Successful in 2m52s
Server and lib tests / Web client test (compose) (push) Successful in 3m23s
Server and lib tests / Web client test (discovery) (push) Successful in 2m49s
Server and lib tests / Web client test (one) (push) Successful in 2m52s
Server and lib tests / Web client test (privacy) (push) Successful in 2m44s
Server and lib tests / Web client test (reporter) (push) Successful in 2m56s
Server and lib tests / Web client test (workflow) (push) Successful in 3m0s
Server and lib tests / Server tests (push) Failing after 4m55s
E2e test on main branch push / notify-failure (push) Failing after 9s
Server and lib tests / Send matrix testing notification (push) Successful in 2s
Mark stale issues and pull requests / stale (push) Successful in 40s
This commit is contained in:
146
server/system/rest/data_privacy_request.go
Normal file
146
server/system/rest/data_privacy_request.go
Normal file
@@ -0,0 +1,146 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/cortezaproject/corteza/server/system/service"
|
||||
"github.com/cortezaproject/corteza/server/system/types"
|
||||
)
|
||||
|
||||
type (
|
||||
DataPrivacyRequest struct {
|
||||
dataPrivacy service.DataPrivacyService
|
||||
ac dataPrivacyAccessController
|
||||
}
|
||||
|
||||
dataPrivacyRequestSetPayload struct {
|
||||
Filter types.DataPrivacyRequestFilter `json:"filter"`
|
||||
Set types.DataPrivacyRequestSet `json:"set"`
|
||||
}
|
||||
|
||||
dataPrivacyAccessController interface {
|
||||
CanGrant(context.Context) bool
|
||||
}
|
||||
|
||||
DataPrivacyRequestComment struct {
|
||||
dataPrivacy service.DataPrivacyService
|
||||
ac dataPrivacyAccessController
|
||||
}
|
||||
|
||||
dataPrivacyRequestCommentSetPayload struct {
|
||||
Filter types.DataPrivacyRequestCommentFilter `json:"filter"`
|
||||
Set types.DataPrivacyRequestCommentSet `json:"set"`
|
||||
}
|
||||
)
|
||||
|
||||
func (DataPrivacyRequest) New() *DataPrivacyRequest {
|
||||
return &DataPrivacyRequest{
|
||||
dataPrivacy: service.DefaultDataPrivacy,
|
||||
ac: service.DefaultAccessControl,
|
||||
}
|
||||
}
|
||||
|
||||
// func (ctrl DataPrivacyRequest) List(ctx context.Context, r *request.DataPrivacyRequestList) (interface{}, error) {
|
||||
// var (
|
||||
// err error
|
||||
// f = types.DataPrivacyRequestFilter{
|
||||
// RequestedBy: payload.ParseUint64s(r.RequestedBy),
|
||||
// Query: r.Query,
|
||||
// Kind: r.Kind,
|
||||
// Status: r.Status,
|
||||
// }
|
||||
// )
|
||||
//
|
||||
// if f.Paging, err = filter.NewPaging(r.Limit, r.PageCursor); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// if f.Sorting, err = filter.NewSorting(r.Sort); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// set, f, err := ctrl.dataPrivacy.FindRequests(ctx, f)
|
||||
// return ctrl.makeFilterPayload(ctx, set, f, err)
|
||||
// }
|
||||
//
|
||||
// func (ctrl DataPrivacyRequest) makeFilterPayload(_ context.Context, rr types.DataPrivacyRequestSet, f types.DataPrivacyRequestFilter, err error) (*dataPrivacyRequestSetPayload, error) {
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// if len(rr) == 0 {
|
||||
// rr = make([]*types.DataPrivacyRequest, 0)
|
||||
// }
|
||||
//
|
||||
// return &dataPrivacyRequestSetPayload{Filter: f, Set: rr}, nil
|
||||
// }
|
||||
//
|
||||
// func (ctrl DataPrivacyRequest) Create(ctx context.Context, r *request.DataPrivacyRequestCreate) (interface{}, error) {
|
||||
// req := &types.DataPrivacyRequest{
|
||||
// Kind: types.CastToRequestKind(r.Kind),
|
||||
// Payload: r.Payload,
|
||||
// }
|
||||
//
|
||||
// return ctrl.dataPrivacy.CreateRequest(ctx, req)
|
||||
// }
|
||||
//
|
||||
// func (ctrl DataPrivacyRequest) UpdateStatus(ctx context.Context, r *request.DataPrivacyRequestUpdateStatus) (interface{}, error) {
|
||||
// req := &types.DataPrivacyRequest{
|
||||
// ID: r.RequestID,
|
||||
// Status: types.CastToRequestStatus(r.Status),
|
||||
// }
|
||||
//
|
||||
// return ctrl.dataPrivacy.UpdateRequestStatus(ctx, req)
|
||||
// }
|
||||
//
|
||||
// func (ctrl DataPrivacyRequest) Read(ctx context.Context, r *request.DataPrivacyRequestRead) (interface{}, error) {
|
||||
// return ctrl.dataPrivacy.FindRequestByID(ctx, r.RequestID)
|
||||
// }
|
||||
|
||||
func (DataPrivacyRequestComment) New() *DataPrivacyRequestComment {
|
||||
return &DataPrivacyRequestComment{
|
||||
dataPrivacy: service.DefaultDataPrivacy,
|
||||
ac: service.DefaultAccessControl,
|
||||
}
|
||||
}
|
||||
|
||||
// func (ctrl DataPrivacyRequestComment) List(ctx context.Context, r *request.DataPrivacyRequestCommentList) (interface{}, error) {
|
||||
// var (
|
||||
// err error
|
||||
// f = types.DataPrivacyRequestCommentFilter{
|
||||
// RequestID: []uint64{r.RequestID},
|
||||
// }
|
||||
// )
|
||||
//
|
||||
// if f.Paging, err = filter.NewPaging(r.Limit, r.PageCursor); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// if f.Sorting, err = filter.NewSorting(r.Sort); err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// set, f, err := ctrl.dataPrivacy.FindRequestComments(ctx, f)
|
||||
// return ctrl.makeFilterPayload(ctx, set, f, err)
|
||||
// }
|
||||
//
|
||||
// func (ctrl DataPrivacyRequestComment) makeFilterPayload(_ context.Context, rr types.DataPrivacyRequestCommentSet, f types.DataPrivacyRequestCommentFilter, err error) (*dataPrivacyRequestCommentSetPayload, error) {
|
||||
// if err != nil {
|
||||
// return nil, err
|
||||
// }
|
||||
//
|
||||
// if len(rr) == 0 {
|
||||
// rr = make([]*types.DataPrivacyRequestComment, 0)
|
||||
// }
|
||||
//
|
||||
// return &dataPrivacyRequestCommentSetPayload{Filter: f, Set: rr}, nil
|
||||
// }
|
||||
//
|
||||
// func (ctrl DataPrivacyRequestComment) Create(ctx context.Context, r *request.DataPrivacyRequestCommentCreate) (interface{}, error) {
|
||||
// req := &types.DataPrivacyRequestComment{
|
||||
// RequestID: r.RequestID,
|
||||
// Comment: r.Comment,
|
||||
// }
|
||||
//
|
||||
// return ctrl.dataPrivacy.CreateRequestComment(ctx, req)
|
||||
// }
|
||||
Reference in New Issue
Block a user