Get rid of previous permission providers
Signed-off-by: Émile Ré <nemile.re@gmail.com>
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1683,6 +1683,7 @@ type RightsRequest struct {
|
||||
ActionTaken *string `json:"actionTaken,omitempty"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
Permission bool `json:"permission"`
|
||||
}
|
||||
|
||||
func (RightsRequest) IsNode() {}
|
||||
@@ -1796,6 +1797,7 @@ type StateOfApplicability struct {
|
||||
SnapshotID *gid.GID `json:"snapshotId,omitempty"`
|
||||
Organization *Organization `json:"organization,omitempty"`
|
||||
Owner *People `json:"owner"`
|
||||
Permission bool `json:"permission"`
|
||||
Controls *ControlConnection `json:"controls"`
|
||||
AvailableControls []*AvailableStateOfApplicabilityControl `json:"availableControls"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
|
||||
@@ -314,7 +314,20 @@ func (r *continualImprovementConnectionResolver) TotalCount(ctx context.Context,
|
||||
|
||||
// Organization is the resolver for the organization field.
|
||||
func (r *controlResolver) Organization(ctx context.Context, obj *types.Control) (*types.Organization, error) {
|
||||
panic(fmt.Errorf("not implemented: Organization - organization"))
|
||||
r.MustAuthorize(ctx, obj.ID, probo.ActionOrganizationGet)
|
||||
|
||||
prb := r.ProboService(ctx, obj.ID.TenantID())
|
||||
|
||||
organization, err := prb.Organizations.Get(ctx, obj.Organization.ID)
|
||||
if err != nil {
|
||||
if errors.Is(err, coredata.ErrResourceNotFound) {
|
||||
return nil, gqlutils.NotFound(err)
|
||||
}
|
||||
|
||||
// TODO no panic use gqlutils.InternalError
|
||||
panic(fmt.Errorf("cannot get organization: %w", err))
|
||||
}
|
||||
return types.NewOrganization(organization), nil
|
||||
}
|
||||
|
||||
// Framework is the resolver for the framework field.
|
||||
@@ -6275,6 +6288,11 @@ func (r *rightsRequestResolver) Organization(ctx context.Context, obj *types.Rig
|
||||
return types.NewOrganization(organization), nil
|
||||
}
|
||||
|
||||
// Permission is the resolver for the permission field.
|
||||
func (r *rightsRequestResolver) Permission(ctx context.Context, obj *types.RightsRequest, action string) (bool, error) {
|
||||
return r.Resolver.Permission(ctx, obj, action)
|
||||
}
|
||||
|
||||
// TotalCount is the resolver for the totalCount field.
|
||||
func (r *rightsRequestConnectionResolver) TotalCount(ctx context.Context, obj *types.RightsRequestConnection) (int, error) {
|
||||
r.MustAuthorize(ctx, obj.ParentID, probo.ActionRightsRequesList)
|
||||
@@ -6658,6 +6676,11 @@ func (r *stateOfApplicabilityResolver) Owner(ctx context.Context, obj *types.Sta
|
||||
return types.NewPeople(people), nil
|
||||
}
|
||||
|
||||
// Permission is the resolver for the permission field.
|
||||
func (r *stateOfApplicabilityResolver) Permission(ctx context.Context, obj *types.StateOfApplicability, action string) (bool, error) {
|
||||
return r.Resolver.Permission(ctx, obj, action)
|
||||
}
|
||||
|
||||
// Controls is the resolver for the controls field.
|
||||
func (r *stateOfApplicabilityResolver) Controls(ctx context.Context, obj *types.StateOfApplicability, first *int, after *page.CursorKey, last *int, before *page.CursorKey, orderBy *types.ControlOrderBy, filter *types.ControlFilter) (*types.ControlConnection, error) {
|
||||
r.MustAuthorize(ctx, obj.ID, probo.ActionControlList)
|
||||
|
||||
Reference in New Issue
Block a user