Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ Rails/AddColumnIndex:
Rails/AfterCommitOverride:
Enabled: true

Rails/ApplicationRecord:
Exclude:
- "lib/**/*.rb"

Rails/AttributeDefaultBlockValue:
Enabled: true

Expand Down Expand Up @@ -646,6 +650,7 @@ RSpec/DuplicatedMetadata:
RSpec/EmptyExampleGroup:
Exclude:
- spec/policies/**/*.rb
- spec/services/filtering/scopes/**/*.rb
- spec/support/shared_examples/**/*.rb

RSpec/EmptyLineAfterFinalLet:
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ gem "faraday-retry", "~> 2.4"
gem "ffi", "~> 1.17"
gem "fugit", "~> 1.12"
gem "geocoder", "~> 1.8"
gem "groupdate", "~> 6.7"
gem "groupdate", "~> 6.8"
gem "hashids", "~> 1.0"
gem "htmlbeautifier", "~> 1.4"
gem "iso-639", "~> 0.3"
Expand Down
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ GEM
attr_required (1.0.2)
autotuner (1.1.0)
aws-eventstream (1.4.0)
aws-partitions (1.1241.0)
aws-partitions (1.1246.0)
aws-sdk-core (3.246.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
Expand All @@ -141,7 +141,7 @@ GEM
aws-sdk-kms (1.124.0)
aws-sdk-core (~> 3, >= 3.244.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.220.0)
aws-sdk-s3 (1.221.0)
aws-sdk-core (~> 3, >= 3.244.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
Expand All @@ -156,7 +156,7 @@ GEM
racc (~> 1.7)
bigdecimal (4.1.2)
bindata (2.5.1)
bootsnap (1.24.0)
bootsnap (1.24.3)
msgpack (~> 1.2)
builder (3.3.0)
cgi (0.5.1)
Expand Down Expand Up @@ -289,7 +289,7 @@ GEM
erubi (1.13.1)
et-orbi (1.4.0)
tzinfo
factory_bot (6.5.6)
factory_bot (6.6.0)
activesupport (>= 6.1.0)
factory_bot_rails (6.5.1)
factory_bot (~> 6.5)
Expand Down Expand Up @@ -377,8 +377,8 @@ GEM
graphql (>= 1.13.0)
graphql-fragment_cache (1.22.2)
graphql (>= 2.1.4)
groupdate (6.7.0)
activesupport (>= 7.1)
groupdate (6.8.0)
activesupport (>= 7.2)
hana (1.3.7)
hashdiff (1.2.1)
hashids (1.0.6)
Expand Down Expand Up @@ -410,9 +410,9 @@ GEM
actionview (>= 7.0.0)
activesupport (>= 7.0.0)
jmespath (1.6.2)
job-iteration (1.13.0)
job-iteration (1.13.1)
activejob (>= 7.0)
json (2.19.4)
json (2.19.5)
json-jwt (1.17.0)
activesupport (>= 4.2)
aes_key_wrap
Expand Down Expand Up @@ -488,7 +488,7 @@ GEM
logger
mini_mime (1.1.5)
mini_portile2 (2.8.9)
minitest (6.0.5)
minitest (6.0.6)
drb (~> 2.0)
prism (~> 1.5)
mods (3.0.5)
Expand All @@ -497,9 +497,9 @@ GEM
iso-639
nokogiri (>= 1.6.6)
nom-xml (~> 1.0)
moxml (0.1.18)
moxml (0.1.20)
msgpack (1.8.0)
multi_json (1.20.1)
multi_json (1.21.1)
mustermann (3.1.1)
mutex_m (0.3.0)
namae (1.2.0)
Expand Down Expand Up @@ -672,7 +672,7 @@ GEM
redcarpet (3.6.1)
redis (5.4.1)
redis-client (>= 0.22.0)
redis-client (0.28.0)
redis-client (0.29.0)
connection_pool
redis-objects (2.0.0)
redis (~> 5.0)
Expand Down Expand Up @@ -841,7 +841,7 @@ GEM
validate_url (1.0.15)
activemodel (>= 3.0.0)
public_suffix
vernier (1.10.0)
vernier (1.10.1)
wapiti (2.1.0)
builder (~> 3.2)
rexml (~> 3.0)
Expand Down Expand Up @@ -941,7 +941,7 @@ DEPENDENCIES
graphql-batch (~> 0.6)
graphql-client (~> 0.26)
graphql-fragment_cache (~> 1.22)
groupdate (~> 6.7)
groupdate (~> 6.8)
hashids (~> 1.0)
htmlbeautifier (~> 1.4)
image_processing (~> 1.14)
Expand Down
6 changes: 6 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class ApplicationController < ActionController::API
include OperationHelpers

before_action :attach_request_id!
before_action :load_current_global_configuration!

# @return [void]
def attach_request_id!
Expand Down Expand Up @@ -37,6 +38,11 @@ def authenticate_user!
end
end

# @return [void]
def load_current_global_configuration!
GlobalConfiguration.current!
end

# Render a standard, localized server error using {#render_single_error!}.
#
# @api private
Expand Down
42 changes: 42 additions & 0 deletions app/graphql/mutations/contributor_claim.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# frozen_string_literal: true

module Mutations
# @see Mutations::Operations::ContributorClaim
class ContributorClaim < Mutations::BaseMutation
description <<~TEXT
A mutation to claim a contributor profile as the current user.

This is intended to be used by depositors who have already had contributions harvested
and may have an existing `Contributor` record in the system.

It relies upon the `canClaim` permission on the given `Contributor`,
and by proxy, whether or not `Contributor.claimed` is `false`.
TEXT

field :contributor, Types::ContributorType, null: true do
description <<~TEXT
The contributor that was claimed by the current user, if successful.
TEXT
end

field :contributor_user_link, Types::ContributorUserLinkType, null: true do
description <<~TEXT
The link between the claimed contributor and the current user, if the claim was successful.
TEXT
end

field :user, Types::UserType, null: true do
description <<~TEXT
The current user, if the claim was successful.
TEXT
end

argument :contributor_id, ID, loads: Types::ContributorType, required: true do
description <<~TEXT
The ID of the contributor to claim. This should be a contributor that has already been harvested for the current user.
TEXT
end

performs_operation! "mutations.operations.contributor_claim"
end
end
39 changes: 39 additions & 0 deletions app/graphql/mutations/contributor_merge.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# frozen_string_literal: true

module Mutations
# @see Mutations::Operations::ContributorMerge
class ContributorMerge < Mutations::BaseMutation
description <<~TEXT
Merge two contributors.

The actual merging will occur in the background after a delay, but the source
contributor will be marked as `MERGING` immediately.
TEXT

field :source, Types::ContributorType, null: true do
description <<~TEXT
The contributor being merged, if successful.
TEXT
end

field :target, Types::ContributorType, null: true do
description <<~TEXT
The contributor being merged into, if successful.
TEXT
end

argument :source_id, ID, loads: Types::ContributorType, required: true do
description <<~TEXT
The ID of the contributor to merge.
TEXT
end

argument :target_id, ID, loads: Types::ContributorType, required: true do
description <<~TEXT
The ID of the contributor to merge into.
TEXT
end

performs_operation! "mutations.operations.contributor_merge"
end
end
2 changes: 2 additions & 0 deletions app/graphql/mutations/contributor_user_link_upsert.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ module Mutations
class ContributorUserLinkUpsert < Mutations::BaseMutation
description <<~TEXT
Create or update a link between a `Contributor` and a `User`.

It relies upon the `canLinkUser` permission on the given `Contributor`.
TEXT

field :contributor, Types::ContributorType, null: true do
Expand Down
4 changes: 3 additions & 1 deletion app/graphql/mutations/submission_target_configure.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ class SubmissionTargetConfigure < Mutations::BaseMutation
TEXT
end

argument :auto_approve_depositors, Boolean, required: false, default_value: false, replace_null_with_default: true do
argument :auto_approve_depositors, Boolean, required: false, default_value: MeruConfig.auto_approve_depositors, replace_null_with_default: true do
description <<~TEXT
Whether depositors should be automatically approved when they request to become a depositor for this submission target.

The default value for this field can be set on a tenant level, but is `true` by default for now.
TEXT
end

Expand Down
4 changes: 4 additions & 0 deletions app/graphql/mutations/update_global_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class UpdateGlobalConfiguration < Mutations::BaseMutation
TEXT
end

argument :contributors, Types::Settings::ContributorsSettingsInputType, required: false do
description "Possible new settings for contributors"
end

argument :depositing, Types::Settings::DepositingSettingsInputType, required: false do
description "Possible new settings for depositing behavior"
end
Expand Down
37 changes: 0 additions & 37 deletions app/graphql/types/abstract_model.rb

This file was deleted.

24 changes: 24 additions & 0 deletions app/graphql/types/admin_permission_grid_type.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# frozen_string_literal: true

module Types
# @see Roles::AdminPermissionGrid
class AdminPermissionGridType < Types::BaseObject
description <<~TEXT
Permissions tied to the admin section of Meru.
TEXT

implements Types::PermissionGridType

field :access, Boolean, null: false do
description <<~TEXT
A permission to access the admin section of Meru.

This is checked in order to determine whether or not
the client should redirect from the admin dashboard (or any admin section)
when a user tries to access it.

Actual access to specific admin features is determined by other permissions.
TEXT
end
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/announcement_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module Types
# @see Mutations::CreateAnnouncement
# @see Mutations::DestroyAnnouncement
# @see Mutations::UpdateAnnouncement
class AnnouncementType < Types::AbstractModel
class AnnouncementType < Types::BaseModel
description <<~TEXT
An announcement tied to an entity. These are configured through the backend and can be used
to provide time-sensensitive information and news about a specific entity in the system.
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/asset_audio_type.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Types
class AssetAudioType < Types::AbstractModel
class AssetAudioType < Types::BaseModel
implements Types::AssetType
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/asset_document_type.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Types
class AssetDocumentType < Types::AbstractModel
class AssetDocumentType < Types::BaseModel
implements Types::AssetType
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/asset_image_type.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Types
class AssetImageType < Types::AbstractModel
class AssetImageType < Types::BaseModel
implements Types::AssetType
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/asset_pdf_type.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Types
class AssetPDFType < Types::AbstractModel
class AssetPDFType < Types::BaseModel
implements Types::AssetType
end
end
2 changes: 1 addition & 1 deletion app/graphql/types/asset_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module AssetType
include Types::BaseInterface

implements ::GraphQL::Types::Relay::Node
implements ::Types::SluggableType
implements ::Support::GQL::SluggableType

description "A generic asset type, implemented by all the more specific kinds"

Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/asset_unknown_type.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

module Types
class AssetUnknownType < Types::AbstractModel
class AssetUnknownType < Types::BaseModel
implements Types::AssetType
end
end
Loading
Loading