@@ -1,8 +1,14 @@
|
|||||||
ALTER TABLE auth_saml_configurations
|
ALTER TABLE
|
||||||
ALTER COLUMN email_domain TYPE CITEXT;
|
iam_saml_configurations
|
||||||
|
ALTER COLUMN
|
||||||
|
email_domain TYPE CITEXT;
|
||||||
|
|
||||||
ALTER TABLE peoples
|
ALTER TABLE
|
||||||
ALTER COLUMN primary_email_address TYPE CITEXT;
|
peoples
|
||||||
|
ALTER COLUMN
|
||||||
|
primary_email_address TYPE CITEXT;
|
||||||
|
|
||||||
ALTER TABLE peoples
|
ALTER TABLE
|
||||||
ALTER COLUMN additional_email_addresses TYPE CITEXT[];
|
peoples
|
||||||
|
ALTER COLUMN
|
||||||
|
additional_email_addresses TYPE CITEXT [];
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
ErrRightsRequestNotFound struct {
|
|
||||||
Identifier string
|
|
||||||
}
|
|
||||||
|
|
||||||
RightsRequest struct {
|
RightsRequest struct {
|
||||||
ID gid.GID `db:"id"`
|
ID gid.GID `db:"id"`
|
||||||
OrganizationID gid.GID `db:"organization_id"`
|
OrganizationID gid.GID `db:"organization_id"`
|
||||||
@@ -49,10 +45,6 @@ type (
|
|||||||
RightsRequests []*RightsRequest
|
RightsRequests []*RightsRequest
|
||||||
)
|
)
|
||||||
|
|
||||||
func (e ErrRightsRequestNotFound) Error() string {
|
|
||||||
return fmt.Sprintf("rights request not found: %q", e.Identifier)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (rr *RightsRequest) CursorKey(field RightsRequestOrderField) page.CursorKey {
|
func (rr *RightsRequest) CursorKey(field RightsRequestOrderField) page.CursorKey {
|
||||||
switch field {
|
switch field {
|
||||||
case RightsRequestOrderFieldCreatedAt:
|
case RightsRequestOrderFieldCreatedAt:
|
||||||
@@ -68,6 +60,21 @@ func (rr *RightsRequest) CursorKey(field RightsRequestOrderField) page.CursorKey
|
|||||||
panic(fmt.Sprintf("unsupported order by: %s", field))
|
panic(fmt.Sprintf("unsupported order by: %s", field))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AuthorizationAttributes returns the authorization attributes for policy evaluation.
|
||||||
|
func (rr *RightsRequest) AuthorizationAttributes(ctx context.Context, conn pg.Conn) (map[string]string, error) {
|
||||||
|
q := `SELECT organization_id FROM rights_requests WHERE id = $1 LIMIT 1;`
|
||||||
|
|
||||||
|
var organizationID gid.GID
|
||||||
|
if err := conn.QueryRow(ctx, q, rr.ID).Scan(&organizationID); err != nil {
|
||||||
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
|
return nil, ErrResourceNotFound
|
||||||
|
}
|
||||||
|
return nil, fmt.Errorf("cannot query rights request authorization attributes: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
return map[string]string{"organization_id": organizationID.String()}, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (rr *RightsRequest) LoadByID(
|
func (rr *RightsRequest) LoadByID(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
conn pg.Conn,
|
conn pg.Conn,
|
||||||
@@ -108,7 +115,7 @@ LIMIT 1;
|
|||||||
request, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[RightsRequest])
|
request, err := pgx.CollectExactlyOneRow(rows, pgx.RowToStructByName[RightsRequest])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if errors.Is(err, pgx.ErrNoRows) {
|
if errors.Is(err, pgx.ErrNoRows) {
|
||||||
return &ErrRightsRequestNotFound{Identifier: rightsRequestID.String()}
|
return ErrResourceNotFound
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt.Errorf("cannot collect rights request: %w", err)
|
return fmt.Errorf("cannot collect rights request: %w", err)
|
||||||
|
|||||||
@@ -71,12 +71,13 @@ var ViewerPolicy = policy.NewPolicy(
|
|||||||
ActionObligationGet, ActionObligationList,
|
ActionObligationGet, ActionObligationList,
|
||||||
ActionContinualImprovementGet, ActionContinualImprovementList,
|
ActionContinualImprovementGet, ActionContinualImprovementList,
|
||||||
ActionProcessingActivityGet, ActionProcessingActivityList,
|
ActionProcessingActivityGet, ActionProcessingActivityList,
|
||||||
ActionDataProtectionImpactAssessmentGet,
|
ActionDataProtectionImpactAssessmentGet, ActionDataProtectionImpactAssessmentList,
|
||||||
ActionTransferImpactAssessmentGet, ActionTransferImpactAssessmentList,
|
ActionTransferImpactAssessmentGet, ActionTransferImpactAssessmentList,
|
||||||
ActionSnapshotGet, ActionSnapshotList,
|
ActionSnapshotGet, ActionSnapshotList,
|
||||||
ActionMeetingGet, ActionMeetingList,
|
ActionMeetingGet, ActionMeetingList,
|
||||||
ActionFileGet, ActionFileDownloadUrl,
|
ActionFileGet, ActionFileDownloadUrl,
|
||||||
ActionSlackConnectionList,
|
ActionSlackConnectionList,
|
||||||
|
ActionRightsRequestGet, ActionRightsRequestList,
|
||||||
).WithSID("entity-read-access").When(organizationCondition),
|
).WithSID("entity-read-access").When(organizationCondition),
|
||||||
|
|
||||||
policy.Allow(
|
policy.Allow(
|
||||||
|
|||||||
@@ -7497,7 +7497,7 @@ func (r *transferImpactAssessmentConnectionResolver) TotalCount(ctx context.Cont
|
|||||||
|
|
||||||
// NdaFileURL is the resolver for the ndaFileUrl field.
|
// NdaFileURL is the resolver for the ndaFileUrl field.
|
||||||
func (r *trustCenterResolver) NdaFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error) {
|
func (r *trustCenterResolver) NdaFileURL(ctx context.Context, obj *types.TrustCenter) (*string, error) {
|
||||||
hasPermission, err := r.Permission(ctx, obj, probo.ActionTrustCenterGetNda)
|
hasPermission, err := r.Resolver.Permission(ctx, obj, probo.ActionTrustCenterGetNda)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(fmt.Errorf("cannot authorize: %w", err))
|
panic(fmt.Errorf("cannot authorize: %w", err))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user