Skip to content
Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/graphql/types/namespace_role_type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class NamespaceRoleType < BaseObject
field :assigned_projects, Types::NamespaceProjectType.connection_type,
description: 'The projects this role is assigned to'

field :assigned_members, Types::NamespaceProjectType.connection_type,
description: 'The projects this role is assigned to'

expose_abilities %i[
assign_role_abilities
assign_role_projects
Expand Down
1 change: 1 addition & 0 deletions app/services/error_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def self.error_codes
namespace_project_not_found: { description: 'The namespace project with the given identifier was not found' },
namespace_member_not_found: { description: 'The namespace member with the given identifier was not found' },
license_not_found: { description: 'The namespace license with the given identifier was not found' },
flow_type_not_found: { description: 'The flow type with the given identifier was not found' },
primary_level_not_found: { description: '', deprecation_reason: 'Outdated concept' },
secondary_level_not_found: { description: '', deprecation_reason: 'Outdated concept' },
tertiary_level_exceeds_parameters: { description: '', deprecation_reason: 'Outdated concept' },
Expand Down
4 changes: 2 additions & 2 deletions app/services/files/upload_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def execute
object.send(attachment_name).attach attachment

unless object.save
ServiceResponse.error(message: 'Failed to save object', error_code: :invalid_attachment,
details: object.errors)
return ServiceResponse.error(message: 'Failed to save object', error_code: :invalid_attachment,
details: object.errors)
end

AuditService.audit(
Expand Down
2 changes: 1 addition & 1 deletion app/services/users/identity/register_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def execute
end
user_session = UserSession.create(user: user)
unless user_session.persisted?
t.rollback_and_return! ServiceResponse.error(message: :invalid_user_session,
t.rollback_and_return! ServiceResponse.error(error_code: :invalid_user_session,
details: user_session.errors)
end

Expand Down
2 changes: 1 addition & 1 deletion app/services/users/logout_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def execute
ServiceResponse.success(message: 'Logged out session', payload: user_session)
else
logger.warn(message: 'Failed to log out session', session_id: user_session.id, user_id: user_session.user_id)
ServiceResponse.error(error_code: user_session.errors)
ServiceResponse.error(error_code: :invalid_user_session, details: user_session.errors)
end
end
end
Expand Down
6 changes: 3 additions & 3 deletions spec/services/users/identity/register_service_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true
# frozen_string_literal: true

require 'rails_helper'

Expand Down Expand Up @@ -58,7 +58,7 @@ def setup_identity_provider(identity)

shared_examples 'invalid user' do |error_code|
it { is_expected.not_to be_success }
it { expect(service_response[:error_code]).to eq(error_code) }
it { expect(service_response.payload[:error_code]).to eq(error_code) }
it { expect { service_response }.not_to create_audit_event }
end

Expand Down Expand Up @@ -183,7 +183,7 @@ def setup_identity_provider(identity)
end

it { is_expected.not_to be_success }
it { expect(service_response[:error_code]).to eq(:invalid_user_identity) }
it { expect(service_response.payload[:error_code]).to eq(:invalid_user_identity) }
it { expect { service_response }.not_to create_audit_event }
it { expect(service_response.payload[:details].full_messages).to include('Identifier has already been taken') }
end
Expand Down
8 changes: 4 additions & 4 deletions spec/support/helpers/graphql_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ def error_query
%(
errors {
errorCode
details {
...on ActiveModelError { attribute type }
...on MessageError { message }
}
details {
...on ActiveModelError { attribute type }
...on MessageError { message }
}
}
)
end
Expand Down