Skip to content

Commit

Permalink
naming
Browse files Browse the repository at this point in the history
  • Loading branch information
samoddball committed Jul 16, 2024
1 parent 5e1e553 commit 3bd6ae8
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions pkg/graph/resolvers/system_intake_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func GetStatusForSystemIntakeDocument(s3Client *upload.S3Client, s3Key string) (

// CreateSystemIntakeDocument uploads a document to S3, then saves its metadata to our database.
func CreateSystemIntakeDocument(ctx context.Context, store *storage.Store, s3Client *upload.S3Client, input models.CreateSystemIntakeDocumentInput) (*models.SystemIntakeDocument, error) {
uploaderRole, err := canCreate(ctx, store, input.RequestID)
uploaderRole, err := validateUploader(ctx, store, input.RequestID)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -157,11 +157,10 @@ func canView(ctx context.Context, store *storage.Store, s3Key string) error {
return errors.New("unauthorized attempt to view system intake document")
}

// canCreate guards unauthorized creation of system intake documents
// validateUploader guards unauthorized creation of system intake documents
// admins can upload documents
// requesters can upload documents
// this also returns the role to use for the uploader, if authorized
func canCreate(ctx context.Context, store *storage.Store, systemIntakeID uuid.UUID) (models.DocumentUploaderRole, error) {
func validateUploader(ctx context.Context, store *storage.Store, systemIntakeID uuid.UUID) (models.DocumentUploaderRole, error) {
intake, err := store.FetchSystemIntakeByID(ctx, systemIntakeID)
if err != nil {
return "", err
Expand Down

0 comments on commit 3bd6ae8

Please sign in to comment.