diff --git a/.gitignore b/.gitignore index a103c3a..33748e0 100644 --- a/.gitignore +++ b/.gitignore @@ -6,11 +6,8 @@ .project .sass-cache coverage -Gemfile.lock tmp nbproject pkg *.swp -spec/dummy -.ruby-version .byebug_history diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b719bc4 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,56 @@ +--- +# ------------------------------------------------------------- +# Stages +# ------------------------------------------------------------- + +stages: + - prepare + - lint + - test + - post-test + - review + - deploy + +# ------------------------------------------------------------- +# Includes +# ------------------------------------------------------------- + +include: + - project: everlywell/projects/gitlab/ci-templates + ref: gl-code-quality-test-coverage + file: + - cache.gitlab-ci.yml + - code-quality.gitlab-ci.yml + - coverage.gitlab-ci.yml + - deploy.gitlab-ci.yml + - frontend.gitlab-ci.yml + - global.gitlab-ci.yml + - rails.gitlab-ci.yml + - rules.gitlab-ci.yml + - static-analysis.gitlab-ci.yml + - workflow.gitlab-ci.yml + +# ------------------------------------------------------------- +# Override included configurations +# ------------------------------------------------------------- + +variables: + APPLICATION: 'spree_admin_roles_and_access' + CI_DEFAULT_IMAGE: 'ruby-2.7.2-bundler-2.1.4-mysql-8.0.28-chrome-100-node-14.16-yarn-1.22-cctestreporter-latest' + RUN_YARN_TESTS: 'false' + USE_WEBPACKER_COMPILE: 'false' + SETUP_DB: 'false' + SETUP_PARALLEL: 'false' + +rspec: + script: + - run_timed_command "bundle exec rake test_app" + - run_timed_command "bundle exec rspec" + +brakeman: + script: + - run_timed_command "bundle exec brakeman $BRAKEMAN_CONFIDENCE_LEVEL --force" + +# ------------------------------------------------------------- +# Application-specific jobs +# ------------------------------------------------------------- diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..7b648f6 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,19 @@ +inherit_from: .rubocop_todo.yml + +require: + - rubocop-rspec + +# inherit_from: .rubocop_todo.yml + +AllCops: + NewCops: enable + TargetRubyVersion: 2.7.0 + Exclude: + - bin/* + - gemfiles/* + - tmp/**/* + - vendor/**/* + - log/**/* +Style/SignalException: + EnforcedStyle: only_raise + diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml new file mode 100644 index 0000000..23df905 --- /dev/null +++ b/.rubocop_todo.yml @@ -0,0 +1,665 @@ +# This configuration was generated by +# `rubocop --auto-gen-config` +# on 2022-04-15 14:54:59 UTC using RuboCop version 1.27.0. +# The point is for the user to remove these configuration records +# one by one as the offenses are removed from the code base. +# Note that changes in the inspected code, or installation of new +# versions of RuboCop, may require this file to be generated again. + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: TreatCommentsAsGroupSeparators, ConsiderPunctuation, Include. +# Include: **/*.gemspec +Gemspec/OrderedDependencies: + Exclude: + - 'spree_admin_roles_and_access.gemspec' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Layout/EmptyLineAfterGuardClause: + Exclude: + - 'config/initializers/cancan_rule.rb' + +# Offense count: 7 +# This cop supports safe auto-correction (--auto-correct). +Layout/EmptyLines: + Exclude: + - 'lib/tasks/populate.rake' + - 'spec/dummy/config/application.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: around, only_before +Layout/EmptyLinesAroundAccessModifier: + Exclude: + - 'app/controllers/spree/admin/roles_controller.rb' + - 'lib/spree/permissions.rb' + +# Offense count: 13 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, no_empty_lines +Layout/EmptyLinesAroundBlockBody: + Exclude: + - 'lib/spree/permissions.rb' + - 'lib/tasks/populate.rake' + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: empty_lines, empty_lines_except_namespace, empty_lines_special, no_empty_lines, beginning_only, ending_only +Layout/EmptyLinesAroundClassBody: + Exclude: + - 'app/models/spree/roles_permission.rb' + - 'lib/generators/spree_admin_roles_and_access/install/install_generator.rb' + - 'spec/dummy/config/application.rb' + +# Offense count: 17 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment. +Layout/ExtraSpacing: + Exclude: + - 'spec/dummy/config/environments/test.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + - 'spec/spec_helper.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: normal, indented_internal_methods +Layout/IndentationConsistency: + Exclude: + - 'app/controllers/spree/admin/roles_controller.rb' + - 'lib/spree/permissions.rb' + - 'spec/dummy/config/application.rb' + +# Offense count: 5 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: Width, IgnoredPatterns. +Layout/IndentationWidth: + Exclude: + - 'app/controllers/spree/admin/roles_controller.rb' + - 'lib/spree/permissions.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowForAlignment, EnforcedStyleForExponentOperator. +# SupportedStylesForExponentOperator: space, no_space +Layout/SpaceAroundOperators: + Exclude: + - 'spec/dummy/config/environments/test.rb' + +# Offense count: 15 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowForAlignment. +Layout/SpaceBeforeFirstArg: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBrackets. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBrackets: space, no_space +Layout/SpaceInsideArrayLiteralBrackets: + Exclude: + - 'spec/dummy/config/environments/production.rb' + +# Offense count: 16 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces. +# SupportedStyles: space, no_space, compact +# SupportedStylesForEmptyBraces: space, no_space +Layout/SpaceInsideHashLiteralBraces: + Exclude: + - 'config/initializers/constants.rb' + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 30 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: space, no_space +Layout/SpaceInsideStringInterpolation: + Exclude: + - 'lib/tasks/populate.rake' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: final_newline, final_blank_line +Layout/TrailingEmptyLines: + Exclude: + - 'spec/dummy/config/application.rb' + - 'spec/dummy/config/initializers/devise.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowInHeredoc. +Layout/TrailingWhitespace: + Exclude: + - 'lib/spree/permissions.rb' + - 'spec/constants_spec.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Lint/AmbiguousOperator: + Exclude: + - 'lib/spree_admin_roles_and_access/engine.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +Lint/AmbiguousOperatorPrecedence: + Exclude: + - 'config/initializers/cancan_rule.rb' + - 'lib/spree/permissions.rb' + +# Offense count: 1 +# Configuration parameters: IgnoreLiteralBranches, IgnoreConstantBranches. +Lint/DuplicateBranch: + Exclude: + - 'lib/tasks/populate.rake' + +# Offense count: 4 +# This cop supports unsafe auto-correction (--auto-correct-all). +Lint/NonDeterministicRequireOrder: + Exclude: + - 'lib/spree_admin_roles_and_access/engine.rb' + - 'spec/dummy/config/application.rb' + - 'spec/spec_helper.rb' + +# Offense count: 2 +# This cop supports unsafe auto-correction (--auto-correct-all). +# Configuration parameters: AllowedImplicitNamespaces. +# AllowedImplicitNamespaces: Gem +Lint/RaiseException: + Exclude: + - 'config/initializers/cancan_ability.rb' + - 'config/initializers/cancan_rule.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments. +Lint/UnusedBlockArgument: + Exclude: + - 'lib/spree/permissions.rb' + +# Offense count: 2 +Lint/UselessAssignment: + Exclude: + - 'lib/tasks/populate.rake' + +# Offense count: 7 +# Configuration parameters: IgnoredMethods, CountRepeatedAttributes. +Metrics/AbcSize: + Max: 27 + +# Offense count: 26 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +# IgnoredMethods: refine +Metrics/BlockLength: + Max: 570 + +# Offense count: 4 +# Configuration parameters: IgnoredMethods. +Metrics/CyclomaticComplexity: + Max: 10 + +# Offense count: 9 +# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods. +Metrics/MethodLength: + Max: 24 + +# Offense count: 2 +# Configuration parameters: IgnoredMethods. +Metrics/PerceivedComplexity: + Max: 11 + +# Offense count: 1 +# Configuration parameters: NamePrefix, ForbiddenPrefixes, AllowedMethods, MethodDefinitionMacros. +# NamePrefix: is_, has_, have_ +# ForbiddenPrefixes: is_, has_, have_ +# AllowedMethods: is_a? +# MethodDefinitionMacros: define_method, define_singleton_method +Naming/PredicateName: + Exclude: + - 'spec/**/*' + - 'app/models/spree_admin_roles_and_access/spree/role_decorator.rb' + +# Offense count: 4 +RSpec/AnyInstance: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +RSpec/BeEq: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 9 +# Configuration parameters: Prefixes. +# Prefixes: when, with, without +RSpec/ContextWording: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 46 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: SkipBlocks, EnforcedStyle. +# SupportedStyles: described_class, explicit +RSpec/DescribedClass: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowConsecutiveOneLiners. +RSpec/EmptyLineAfterExample: + Exclude: + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +RSpec/EmptyLineAfterExampleGroup: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +RSpec/EmptyLineAfterFinalLet: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +RSpec/EmptyLineAfterHook: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +RSpec/EmptyLineAfterSubject: + Exclude: + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 106 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: CustomTransform, IgnoredWords. +RSpec/ExampleWording: + Exclude: + - 'spec/constants_spec.rb' + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 46 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, each, example +RSpec/HookArgument: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + - 'spec/spec_helper.rb' + +# Offense count: 10 +# Configuration parameters: AssignmentOnly. +RSpec/InstanceVariable: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + +# Offense count: 23 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: it_behaves_like, it_should_behave_like +RSpec/ItBehavesLike: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 13 +# This cop supports safe auto-correction (--auto-correct). +RSpec/LeadingSubject: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 67 +# Configuration parameters: . +# SupportedStyles: have_received, receive +RSpec/MessageSpies: + EnforcedStyle: receive + +# Offense count: 1 +RSpec/MultipleExpectations: + Max: 2 + +# Offense count: 96 +# Configuration parameters: AllowSubject. +RSpec/MultipleMemoizedHelpers: + Max: 33 + +# Offense count: 29 +# Configuration parameters: IgnoreSharedExamples. +RSpec/NamedSubject: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + - 'spec/models/spree/user_decorator_spec.rb' + +# Offense count: 31 +RSpec/NestedGroups: + Max: 5 + +# Offense count: 33 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: not_to, to_not +RSpec/NotToNot: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/permission_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 10 +RSpec/RepeatedDescription: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 6 +RSpec/RepeatedExampleGroupDescription: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + +# Offense count: 52 +RSpec/StubbedMock: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + - 'spec/models/spree/ability_decorator_spec.rb' + - 'spec/models/spree/permission_spec.rb' + +# Offense count: 1 +# Configuration parameters: IgnoreNameless, IgnoreSymbolicNames. +RSpec/VerifiedDoubles: + Exclude: + - 'spec/controllers/spree/admin/roles_controller_spec.rb' + +# Offense count: 3 +# Configuration parameters: EnforcedStyle, AllowModifiersOnSymbols. +# SupportedStyles: inline, group +Style/AccessModifierDeclarations: + Exclude: + - 'app/controllers/spree/admin/default_admin_dashboards_controller.rb' + - 'app/controllers/spree/admin/permission_sets_controller.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: prefer_alias, prefer_alias_method +Style/Alias: + Exclude: + - 'config/initializers/auth.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: nested, compact +Style/ClassAndModuleChildren: + Exclude: + - 'app/controllers/spree/admin/default_admin_dashboards_controller.rb' + - 'config/initializers/auth.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: is_a?, kind_of? +Style/ClassCheck: + Exclude: + - 'config/initializers/cancan_rule.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: IgnoredMethods. +# IgnoredMethods: ==, equal?, eql? +Style/ClassEqualityComparison: + Exclude: + - 'config/initializers/cancan_rule.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, SingleLineConditionsOnly, IncludeTernaryExpressions. +# SupportedStyles: assign_to_condition, assign_inside_condition +Style/ConditionalAssignment: + Exclude: + - 'app/controllers/spree_admin_roles_and_access/spree/admin/base_controller_decorator.rb' + +# Offense count: 23 +# Configuration parameters: AllowedConstants. +Style/Documentation: + Enabled: false + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: compact, expanded +Style/EmptyMethod: + Exclude: + - 'app/controllers/spree/admin/default_admin_dashboards_controller.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +Style/ExpandPathArguments: + Exclude: + - 'spec/dummy/config/application.rb' + - 'spec/dummy/config/boot.rb' + - 'spec/spec_helper.rb' + +# Offense count: 76 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: always, always_true, never +Style/FrozenStringLiteralComment: + Enabled: false + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Style/GlobalStdStream: + Exclude: + - 'spec/dummy/config/environments/production.rb' + +# Offense count: 1 +# Configuration parameters: MinBodyLength. +Style/GuardClause: + Exclude: + - 'lib/spree/permissions.rb' + +# Offense count: 4 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: braces, no_braces +Style/HashAsLastArrayItem: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 6 +# This cop supports safe auto-correction (--auto-correct). +Style/IfUnlessModifier: + Exclude: + - 'config/initializers/cancan_ability.rb' + - 'lib/tasks/populate.rake' + - 'spec/dummy/config/initializers/devise.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: line_count_dependent, lambda, literal +Style/Lambda: + Exclude: + - 'app/models/spree/permission.rb' + - 'app/models/spree_admin_roles_and_access/spree/role_decorator.rb' + +# Offense count: 1 +Style/MissingRespondToMissing: + Exclude: + - 'lib/spree/permissions.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: literals, strict +Style/MutableConstant: + Exclude: + - 'config/initializers/constants.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowedMethods. +# AllowedMethods: be, be_a, be_an, be_between, be_falsey, be_kind_of, be_instance_of, be_truthy, be_within, eq, eql, end_with, include, match, raise_error, respond_to, start_with +Style/NestedParenthesizedCalls: + Exclude: + - 'lib/generators/spree_admin_roles_and_access/install/install_generator.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: PreferredDelimiters. +Style/PercentLiteralDelimiters: + Exclude: + - 'lib/spree_admin_roles_and_access/engine.rb' + - 'spec/dummy/config/application.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Style/Proc: + Exclude: + - 'spec/models/spree/ability_decorator_spec.rb' + +# Offense count: 2 +# This cop supports unsafe auto-correction (--auto-correct-all). +# Configuration parameters: SafeForConstants. +Style/RedundantFetchBlock: + Exclude: + - 'spec/dummy/config/puma.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +Style/RedundantInterpolation: + Exclude: + - 'app/controllers/spree_admin_roles_and_access/spree/admin/base_controller_decorator.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowMultipleReturnValues. +Style/RedundantReturn: + Exclude: + - 'lib/spree/permissions.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +Style/RedundantSelf: + Exclude: + - 'app/models/spree_admin_roles_and_access/spree/ability_decorator.rb' + - 'lib/spree/permissions.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, AllowInnerSlashes. +# SupportedStyles: slashes, percent_r, mixed +Style/RegexpLiteral: + Exclude: + - 'lib/generators/spree_admin_roles_and_access/install/install_generator.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle. +# SupportedStyles: implicit, explicit +Style/RescueStandardError: + Exclude: + - 'app/controllers/spree_admin_roles_and_access/spree/admin/base_controller_decorator.rb' + +# Offense count: 1 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: ConvertCodeThatCanStartToReturnNil, AllowedMethods, MaxChainLength. +# AllowedMethods: present?, blank?, presence, try, try! +Style/SafeNavigation: + Exclude: + - 'config/initializers/auth.rb' + +# Offense count: 3 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowAsExpressionSeparator. +Style/Semicolon: + Exclude: + - 'spec/models/spree/permission_set_spec.rb' + - 'spec/models/spree/role_decorator_spec.rb' + +# Offense count: 100 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline. +# SupportedStyles: single_quotes, double_quotes +Style/StringLiterals: + Enabled: false + +# Offense count: 93 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: MinSize. +# SupportedStyles: percent, brackets +Style/SymbolArray: + EnforcedStyle: brackets + +# Offense count: 1 +# This cop supports unsafe auto-correction (--auto-correct-all). +# Configuration parameters: AllowMethodsWithArguments, IgnoredMethods. +# IgnoredMethods: respond_to, define_method +Style/SymbolProc: + Exclude: + - 'app/controllers/spree/admin/default_admin_dashboards_controller.rb' + +# Offense count: 2 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: EnforcedStyleForMultiline. +# SupportedStylesForMultiline: comma, consistent_comma, no_comma +Style/TrailingCommaInArrayLiteral: + Exclude: + - 'lib/tasks/populate.rake' + +# Offense count: 31 +# This cop supports safe auto-correction (--auto-correct). +# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns. +# URISchemes: http, https +Layout/LineLength: + Max: 229 diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..2eb2fe9 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +ruby-2.7.2 diff --git a/Appraisals b/Appraisals index 6859991..5f4fe79 100644 --- a/Appraisals +++ b/Appraisals @@ -1,31 +1,19 @@ -appraise "spree-3-2" do - gem "spree", "~> 3.2.0" - gem "spree_auth_devise", "~> 3.2.0" -end - -appraise "spree-3-3" do - gem "spree", "~> 3.3.0" - gem "spree_auth_devise", "~> 3.3.0" -end - -appraise "spree-3-4" do - gem "spree", '~> 3.4.0' - gem 'spree_auth_devise', github: 'spree/spree_auth_devise', branch: 'master' -end - -appraise 'spree-3-5' do - gem 'spree', '~> 3.5.0' - gem 'spree_auth_devise', '~> 3.3.0' +appraise 'spree-3-7' do + gem 'spree', '~> 3.7.0' + gem 'spree_backend', '~> 3.7.0' + gem 'spree_auth_devise', '~> 3.5.0' end -appraise 'spree-3-6' do - gem 'spree', '~> 3.6.0' - gem 'spree_auth_devise', '~> 3.3.0' +appraise 'spree-4-0' do + gem 'spree', '~> 4.0.0' + gem 'spree_backend', '~> 4.0.0' + gem 'spree_auth_devise' end -appraise 'spree-3-7' do - gem 'spree', '~> 3.7.0' - gem 'spree_auth_devise', '~> 3.5.0' +appraise 'spree-4-1' do + gem 'spree', '~> 4.1.0' + gem 'spree_backend', '~> 4.1.0' + gem 'spree_auth_devise' end appraise 'spree-master' do diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..b20801f --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,468 @@ +PATH + remote: . + specs: + spree_admin_roles_and_access (3.pre.0.pre.stable) + spree_auth_devise + spree_core (>= 3.7.0, < 5.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (7.0.2.3) + actionpack (= 7.0.2.3) + activesupport (= 7.0.2.3) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (7.0.2.3) + actionpack (= 7.0.2.3) + activejob (= 7.0.2.3) + activerecord (= 7.0.2.3) + activestorage (= 7.0.2.3) + activesupport (= 7.0.2.3) + mail (>= 2.7.1) + net-imap + net-pop + net-smtp + actionmailer (7.0.2.3) + actionpack (= 7.0.2.3) + actionview (= 7.0.2.3) + activejob (= 7.0.2.3) + activesupport (= 7.0.2.3) + mail (~> 2.5, >= 2.5.4) + net-imap + net-pop + net-smtp + rails-dom-testing (~> 2.0) + actionpack (7.0.2.3) + actionview (= 7.0.2.3) + activesupport (= 7.0.2.3) + rack (~> 2.0, >= 2.2.0) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (7.0.2.3) + actionpack (= 7.0.2.3) + activerecord (= 7.0.2.3) + activestorage (= 7.0.2.3) + activesupport (= 7.0.2.3) + globalid (>= 0.6.0) + nokogiri (>= 1.8.5) + actionview (7.0.2.3) + activesupport (= 7.0.2.3) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + active_storage_validations (0.9.5) + rails (>= 5.2.0) + activejob (7.0.2.3) + activesupport (= 7.0.2.3) + globalid (>= 0.3.6) + activemerchant (1.125.0) + activesupport (>= 4.2) + builder (>= 2.1.2, < 4.0.0) + i18n (>= 0.6.9) + nokogiri (~> 1.4) + activemodel (7.0.2.3) + activesupport (= 7.0.2.3) + activerecord (7.0.2.3) + activemodel (= 7.0.2.3) + activesupport (= 7.0.2.3) + activerecord-typedstore (1.4.0) + activerecord (>= 5.2) + activestorage (7.0.2.3) + actionpack (= 7.0.2.3) + activejob (= 7.0.2.3) + activerecord (= 7.0.2.3) + activesupport (= 7.0.2.3) + marcel (~> 1.0) + mini_mime (>= 1.1.0) + activesupport (7.0.2.3) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 1.6, < 2) + minitest (>= 5.1) + tzinfo (~> 2.0) + acts_as_list (1.0.4) + activerecord (>= 4.2) + addressable (2.8.0) + public_suffix (>= 2.0.2, < 5.0) + appraisal (2.4.1) + bundler + rake + thor (>= 0.14.0) + ast (2.4.2) + auto_strip_attributes (2.6.0) + activerecord (>= 4.0) + awesome_nested_set (3.5.0) + activerecord (>= 4.0.0, < 7.1) + bcrypt (3.1.17) + brakeman (5.2.2) + builder (3.2.4) + bundler-audit (0.9.0.1) + bundler (>= 1.2.0, < 3) + thor (~> 1.0) + byebug (11.1.3) + cancancan (3.3.0) + capybara (3.36.0) + addressable + matrix + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (>= 1.5, < 3.0) + xpath (~> 3.2) + carmen (1.1.3) + activesupport (>= 3.0.0) + childprocess (4.1.0) + cliver (0.3.2) + coderay (1.1.3) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.10) + crass (1.0.6) + database_cleaner (2.0.1) + database_cleaner-active_record (~> 2.0.0) + database_cleaner-active_record (2.0.1) + activerecord (>= 5.a) + database_cleaner-core (~> 2.0.0) + database_cleaner-core (2.0.1) + devise (4.8.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + devise-encryptable (0.2.0) + devise (>= 2.1.0) + diff-lcs (1.5.0) + digest (3.1.0) + docile (1.4.0) + doorkeeper (5.5.4) + railties (>= 5) + erubi (1.10.0) + execjs (2.8.1) + factory_girl (4.9.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) + railties (>= 3.0.0) + ffaker (2.21.0) + ffi (1.15.5) + friendly_id (5.4.2) + activerecord (>= 4.0.0) + globalid (1.0.0) + activesupport (>= 5.0) + highline (2.0.3) + i18n (1.10.0) + concurrent-ruby (~> 1.0) + image_processing (1.12.2) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + jsonapi-serializer (2.2.0) + activesupport (>= 4.2) + kaminari (1.2.2) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.2.2) + kaminari-activerecord (= 1.2.2) + kaminari-core (= 1.2.2) + kaminari-actionview (1.2.2) + actionview + kaminari-core (= 1.2.2) + kaminari-activerecord (1.2.2) + activerecord + kaminari-core (= 1.2.2) + kaminari-core (1.2.2) + launchy (2.5.0) + addressable (~> 2.7) + loofah (2.16.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (1.0.2) + matrix (0.4.2) + method_source (1.0.0) + mini_magick (4.11.0) + mini_mime (1.1.2) + mini_portile2 (2.8.0) + minitest (5.15.0) + monetize (1.12.0) + money (~> 6.12) + money (6.16.0) + i18n (>= 0.6.4, <= 2) + net-imap (0.2.3) + digest + net-protocol + strscan + net-pop (0.1.1) + digest + net-protocol + timeout + net-protocol (0.1.3) + timeout + net-smtp (0.3.1) + digest + net-protocol + timeout + nio4r (2.5.8) + nokogiri (1.13.4) + mini_portile2 (~> 2.8.0) + racc (~> 1.4) + orm_adapter (0.5.0) + parallel (1.22.1) + paranoia (2.6.0) + activerecord (>= 5.1, < 7.1) + parser (3.1.2.0) + ast (~> 2.4.1) + pg (1.3.5) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) + cliver (~> 0.3.1) + websocket-driver (>= 0.2.0) + pry (0.14.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.7) + rabl (0.15.0) + activesupport (>= 2.3.14) + racc (1.6.0) + rack (2.2.3) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (7.0.2.3) + actioncable (= 7.0.2.3) + actionmailbox (= 7.0.2.3) + actionmailer (= 7.0.2.3) + actionpack (= 7.0.2.3) + actiontext (= 7.0.2.3) + actionview (= 7.0.2.3) + activejob (= 7.0.2.3) + activemodel (= 7.0.2.3) + activerecord (= 7.0.2.3) + activestorage (= 7.0.2.3) + activesupport (= 7.0.2.3) + bundler (>= 1.15.0) + railties (= 7.0.2.3) + rails-controller-testing (1.0.5) + actionpack (>= 5.0.1.rc1) + actionview (>= 5.0.1.rc1) + activesupport (>= 5.0.1.rc1) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.4.2) + loofah (~> 2.3) + railties (7.0.2.3) + actionpack (= 7.0.2.3) + activesupport (= 7.0.2.3) + method_source + rake (>= 12.2) + thor (~> 1.0) + zeitwerk (~> 2.5) + rainbow (3.1.1) + rake (13.0.6) + ransack (2.6.0) + activerecord (>= 6.0.4) + activesupport (>= 6.0.4) + i18n + redis (4.6.0) + regexp_parser (2.3.0) + responders (3.0.1) + actionpack (>= 5.0) + railties (>= 5.0) + rexml (3.2.5) + rspec-activemodel-mocks (1.1.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + rspec-mocks (>= 2.99, < 4.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + rubocop (1.27.0) + parallel (~> 1.10) + parser (>= 3.1.0.0) + rainbow (>= 2.2.2, < 4.0) + regexp_parser (>= 1.8, < 3.0) + rexml + rubocop-ast (>= 1.16.0, < 2.0) + ruby-progressbar (~> 1.7) + unicode-display_width (>= 1.4.0, < 3.0) + rubocop-ast (1.17.0) + parser (>= 3.1.1.0) + rubocop-rspec (2.9.0) + rubocop (~> 1.19) + ruby-progressbar (1.11.0) + ruby-vips (2.1.4) + ffi (~> 1.12) + rubyzip (2.3.2) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.4.0) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + selenium-webdriver (4.1.0) + childprocess (>= 0.5, < 5.0) + rexml (~> 3.2, >= 3.2.5) + rubyzip (>= 1.2.2) + semaphore_cucumber_booster_config (1.4.2) + thor (>= 0.19.1, < 2.0) + semaphore_test_boosters (2.7.1) + semaphore_cucumber_booster_config (~> 1.4.2) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) + simplecov (0.21.2) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov_json_formatter (~> 0.1) + simplecov-cobertura (2.1.0) + rexml + simplecov (~> 0.19) + simplecov-html (0.12.3) + simplecov_json_formatter (0.1.4) + spree (4.4.0) + spree_api (= 4.4.0) + spree_cli (= 4.4.0) + spree_core (= 4.4.0) + spree_api (4.4.0) + bcrypt (~> 3.1) + doorkeeper (~> 5.3) + jsonapi-serializer (~> 2.1) + rabl (~> 0.14, >= 0.14.2) + responders + spree_core (= 4.4.0) + spree_auth_devise (4.4.2) + devise (~> 4.7) + devise-encryptable (= 0.2.0) + spree_core (>= 4.3.0.rc1) + spree_extension + spree_cli (4.4.0) + thor (~> 1.0) + spree_core (4.4.0) + actionpack (>= 5.2) + actionview (>= 5.2) + active_storage_validations (~> 0.9, <= 0.9.5) + activejob (>= 5.2) + activemerchant (~> 1.67) + activemodel (>= 5.2) + activerecord (>= 5.2) + activerecord-typedstore + activestorage (>= 5.2) + activesupport (>= 5.2) + acts_as_list (>= 0.8) + auto_strip_attributes (~> 2.6) + awesome_nested_set (~> 3.3, >= 3.3.1) + cancancan (~> 3.2) + carmen (>= 1.0) + friendly_id (~> 5.2, >= 5.2.1) + highline (~> 2.0) + image_processing (~> 1.2) + kaminari (~> 1.2) + mini_magick (~> 4.9, >= 4.9.4) + monetize (~> 1.9) + money (~> 6.13) + paranoia (~> 2.4) + railties (>= 5.2) + ransack (~> 2.3) + rexml + state_machines-activemodel (~> 0.7) + state_machines-activerecord (~> 0.6) + stringex + validates_zipcode + spree_extension (0.0.9) + activerecord (>= 4.2) + spree_core + sprockets (4.0.3) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.4.2) + actionpack (>= 5.2) + activesupport (>= 5.2) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + state_machines (0.5.0) + state_machines-activemodel (0.8.0) + activemodel (>= 5.1) + state_machines (>= 0.5.0) + state_machines-activerecord (0.8.0) + activerecord (>= 5.1) + state_machines-activemodel (>= 0.8.0) + stringex (2.8.5) + strscan (3.0.1) + thor (1.2.1) + tilt (2.0.10) + timeout (0.2.0) + tzinfo (2.0.4) + concurrent-ruby (~> 1.0) + unicode-display_width (2.1.0) + validates_zipcode (0.5.0) + activemodel (>= 4.2.0) + warden (1.2.9) + rack (>= 2.0.9) + websocket-driver (0.7.5) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.5) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.5.4) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + brakeman + bundler-audit + byebug + capybara + coffee-rails + database_cleaner + factory_girl_rails + ffaker + launchy + pg + poltergeist + pry + rails-controller-testing + redis + rspec-activemodel-mocks + rspec-rails (~> 3.5.0) + rubocop + rubocop-rspec + sass-rails + selenium-webdriver + semaphore_test_boosters + shoulda-matchers (~> 3.1) + simplecov (= 0.21.2) + simplecov-cobertura + spree (>= 3.7.0, < 5.0.0) + spree_admin_roles_and_access! + spree_auth_devise + sqlite3 + +BUNDLED WITH + 2.1.4 diff --git a/Rakefile b/Rakefile index 693e483..5e8baa1 100644 --- a/Rakefile +++ b/Rakefile @@ -11,5 +11,5 @@ task default: [:spec] desc 'Generates a dummy app for testing' task :test_app do ENV['LIB_NAME'] = 'spree_admin_roles_and_access' - Rake::Task['extension:test_app'].invoke + Rake::Task['extension:test_app'].invoke('Spree::User') end diff --git a/app/controllers/spree/admin/base_controller_decorator.rb b/app/controllers/spree/admin/base_controller_decorator.rb deleted file mode 100644 index 990928f..0000000 --- a/app/controllers/spree/admin/base_controller_decorator.rb +++ /dev/null @@ -1,27 +0,0 @@ -Spree::Admin::BaseController.class_eval do - def authorize_admin - begin - if params[:id] - record = model_class.where(PARAM_ATTRIBUTE[controller_name] => params[:id]).first - elsif new_action? - record = model_class.new - else - record = model_class - end - raise if record.blank? - rescue - record = "#{params[:controller]}" - end - authorize! :admin, record - authorize_with_attributes! params[:action].to_sym, record, params[controller_name.singularize] - end - - private - def unauthorized - redirect_unauthorized_access - end - - def new_action? - NEW_ACTIONS.include?(params[:action].to_sym) - end -end diff --git a/app/controllers/spree_admin_roles_and_access/spree/admin/base_controller_decorator.rb b/app/controllers/spree_admin_roles_and_access/spree/admin/base_controller_decorator.rb new file mode 100644 index 0000000..1dc09b6 --- /dev/null +++ b/app/controllers/spree_admin_roles_and_access/spree/admin/base_controller_decorator.rb @@ -0,0 +1,36 @@ +module SpreeAdminRolesAndAccess + module Spree + module Admin + module BaseControllerDecorator + def authorize_admin + begin + if params[:id] + record = model_class.where(PARAM_ATTRIBUTE[controller_name] => params[:id]).first + elsif new_action? + record = model_class.new + else + record = model_class + end + raise if record.blank? + rescue + record = "#{params[:controller]}" + end + authorize! :admin, record + authorize_with_attributes! params[:action].to_sym, record, params[controller_name.singularize] + end + + private + + def unauthorized + redirect_unauthorized_access + end + + def new_action? + NEW_ACTIONS.include?(params[:action].to_sym) + end + end + end + end +end + +::Spree::Admin::BaseController.prepend SpreeAdminRolesAndAccess::Spree::Admin::BaseControllerDecorator diff --git a/app/models/spree/ability_decorator.rb b/app/models/spree/ability_decorator.rb deleted file mode 100644 index 52e9ef7..0000000 --- a/app/models/spree/ability_decorator.rb +++ /dev/null @@ -1,28 +0,0 @@ -module Spree - Ability.class_eval do - - def initialize(user) - self.clear_aliased_actions - - alias_action :edit, to: :update - alias_action :new, to: :create - alias_action :new_action, to: :create - alias_action :show, to: :read - alias_action :index, to: :read - alias_action :delete, to: :destroy - - user ||= Spree.user_class.new - - user_roles(user).map(&:permissions).flatten.uniq.map { |permission| permission.ability(self, user) } - - Ability.abilities.each do |clazz| - ability = clazz.send(:new, user) - @rules = rules + ability.send(:rules) - end - end - - def user_roles(user) - (roles = user.roles.includes(:permissions)).empty? ? Spree::Role.default_role.includes(:permissions) : roles - end - end -end diff --git a/app/models/spree/role_decorator.rb b/app/models/spree/role_decorator.rb deleted file mode 100644 index bb1f04a..0000000 --- a/app/models/spree/role_decorator.rb +++ /dev/null @@ -1,18 +0,0 @@ -Spree::Role.class_eval do - - has_many :roles_permission_sets, dependent: :destroy - has_many :permission_sets, through: :roles_permission_sets - has_many :permissions, through: :permission_sets - - # DEPRECATED: Use permission sets instead. Only here for aiding migration for existing users - has_and_belongs_to_many :legacy_permissions, join_table: 'spree_roles_permissions', class_name: 'Spree::Permission' - - validates :name, uniqueness: true, allow_blank: true - validates :permission_sets, length: { minimum: 1, too_short: :atleast_one_permission_set_is_required }, on: :update - - def has_permission?(permission_title) - permissions.pluck(:title).include?(permission_title) - end - - scope :default_role, lambda { where(is_default: true) } -end diff --git a/app/models/spree/user_decorator.rb b/app/models/spree/user_decorator.rb deleted file mode 100644 index 35b09e7..0000000 --- a/app/models/spree/user_decorator.rb +++ /dev/null @@ -1,5 +0,0 @@ -module Spree - Spree.user_class.class_eval do - alias_attribute :roles, :spree_roles - end -end diff --git a/app/models/spree_admin_roles_and_access/spree/ability_decorator.rb b/app/models/spree_admin_roles_and_access/spree/ability_decorator.rb new file mode 100644 index 0000000..fc79f3a --- /dev/null +++ b/app/models/spree_admin_roles_and_access/spree/ability_decorator.rb @@ -0,0 +1,31 @@ +module SpreeAdminRolesAndAccess + module Spree + module AbilityDecorator + def initialize(user) + self.clear_aliased_actions + + alias_action :edit, to: :update + alias_action :new, to: :create + alias_action :new_action, to: :create + alias_action :show, to: :read + alias_action :index, to: :read + alias_action :delete, to: :destroy + + user ||= ::Spree.user_class.new + + user_roles(user).map(&:permissions).flatten.uniq.map { |permission| permission.ability(self, user) } + + ::Spree::Ability.abilities.each do |clazz| + ability = clazz.send(:new, user) + @rules = rules + ability.send(:rules) + end + end + + def user_roles(user) + (roles = user.roles.includes(:permissions)).empty? ? ::Spree::Role.spree_default_role.includes(:permissions) : roles + end + end + end +end + +::Spree::Ability.prepend SpreeAdminRolesAndAccess::Spree::AbilityDecorator diff --git a/app/models/spree_admin_roles_and_access/spree/role_decorator.rb b/app/models/spree_admin_roles_and_access/spree/role_decorator.rb new file mode 100644 index 0000000..4fbb111 --- /dev/null +++ b/app/models/spree_admin_roles_and_access/spree/role_decorator.rb @@ -0,0 +1,25 @@ +module SpreeAdminRolesAndAccess + module Spree + module RoleDecorator + def self.prepended(base) + base.has_many :roles_permission_sets, dependent: :destroy + base.has_many :permission_sets, through: :roles_permission_sets + base.has_many :permissions, through: :permission_sets + + # DEPRECATED: Use permission sets instead. Only here for aiding migration for existing users + base.has_and_belongs_to_many :legacy_permissions, join_table: 'spree_roles_permissions', class_name: 'Spree::Permission' + + base.validates :name, uniqueness: true, allow_blank: true + base.validates :permission_sets, length: { minimum: 1, too_short: :atleast_one_permission_set_is_required }, on: :update + + base.scope :spree_default_role, lambda { where(is_default: true) } + end + + def has_permission?(permission_title) + permissions.pluck(:title).include?(permission_title) + end + end + end +end + +::Spree::Role.prepend SpreeAdminRolesAndAccess::Spree::RoleDecorator diff --git a/app/models/spree_admin_roles_and_access/spree/user_decorator.rb b/app/models/spree_admin_roles_and_access/spree/user_decorator.rb new file mode 100644 index 0000000..a1ad989 --- /dev/null +++ b/app/models/spree_admin_roles_and_access/spree/user_decorator.rb @@ -0,0 +1,11 @@ +module SpreeAdminRolesAndAccess + module Spree + module UserDecorator + def self.prepended(base) + base.alias_attribute :roles, :spree_roles + end + end + end +end + +::Spree::User.prepend SpreeAdminRolesAndAccess::Spree::UserDecorator diff --git a/gemfiles/spree_3_7.gemfile.lock b/gemfiles/spree_3_7.gemfile.lock new file mode 100644 index 0000000..31d6b06 --- /dev/null +++ b/gemfiles/spree_3_7.gemfile.lock @@ -0,0 +1,431 @@ +PATH + remote: .. + specs: + spree_admin_roles_and_access (3.pre.0.pre.stable) + spree_auth_devise + spree_core (>= 3.7.0, < 5.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (5.2.4.2) + actionpack (= 5.2.4.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailer (5.2.4.2) + actionpack (= 5.2.4.2) + actionview (= 5.2.4.2) + activejob (= 5.2.4.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (5.2.4.2) + actionview (= 5.2.4.2) + activesupport (= 5.2.4.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.2) + actionview (5.2.4.2) + activesupport (= 5.2.4.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.0.3) + activejob (5.2.4.2) + activesupport (= 5.2.4.2) + globalid (>= 0.3.6) + activemerchant (1.107.1) + activesupport (>= 4.2) + builder (>= 2.1.2, < 4.0.0) + i18n (>= 0.6.9) + nokogiri (~> 1.4) + activemodel (5.2.4.2) + activesupport (= 5.2.4.2) + activerecord (5.2.4.2) + activemodel (= 5.2.4.2) + activesupport (= 5.2.4.2) + arel (>= 9.0) + activestorage (5.2.4.2) + actionpack (= 5.2.4.2) + activerecord (= 5.2.4.2) + marcel (~> 0.3.1) + activesupport (5.2.4.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + acts-as-taggable-on (6.0.0) + activerecord (~> 5.0) + acts_as_list (0.9.19) + activerecord (>= 3.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + arel (9.0.0) + autoprefixer-rails (9.7.6) + execjs + awesome_nested_set (3.2.0) + activerecord (>= 4.0.0, < 7.0) + bcrypt (3.1.13) + bootstrap-sass (3.4.1) + autoprefixer-rails (>= 5.2.1) + sassc (>= 2.0.0) + builder (3.2.4) + byebug (11.1.1) + camertron-eprun (1.1.1) + cancancan (2.3.0) + canonical-rails (0.2.8) + rails (>= 4.1, < 6.1) + capybara (3.32.1) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) + carmen (1.0.2) + activesupport (>= 3.0.0) + childprocess (3.0.0) + cldr-plurals-runtime-rb (1.0.1) + climate_control (0.2.0) + cliver (0.3.2) + coderay (1.1.2) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.6) + crass (1.0.6) + css_parser (1.7.1) + addressable + database_cleaner (1.8.4) + deface (1.5.3) + nokogiri (>= 1.6) + polyglot + rails (>= 4.1) + rainbow (>= 2.1.0) + devise (4.6.2) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0, < 6.0) + responders + warden (~> 1.2.3) + devise-encryptable (0.2.0) + devise (>= 2.1.0) + diff-lcs (1.3) + docile (1.3.2) + doorkeeper (5.3.1) + railties (>= 5) + erubi (1.9.0) + execjs (2.7.0) + factory_girl (4.9.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) + railties (>= 3.0.0) + fast_jsonapi (1.5) + activesupport (>= 4.2) + ffaker (2.14.0) + ffi (1.12.2) + friendly_id (5.2.5) + activerecord (>= 4.0.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + highline (2.0.3) + htmlentities (4.3.4) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + jquery-rails (4.3.5) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (6.0.1) + railties (>= 3.2.16) + kaminari (1.0.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.0.1) + kaminari-activerecord (= 1.0.1) + kaminari-core (= 1.0.1) + kaminari-actionview (1.0.1) + actionview + kaminari-core (= 1.0.1) + kaminari-activerecord (1.0.1) + activerecord + kaminari-core (= 1.0.1) + kaminari-core (1.0.1) + launchy (2.5.0) + addressable (~> 2.7) + loofah (2.5.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mime-types (3.3.1) + mime-types-data (~> 3.2015) + mime-types-data (3.2019.1009) + mimemagic (0.3.4) + mini_magick (4.9.5) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + monetize (1.9.4) + money (~> 6.12) + money (6.13.7) + i18n (>= 0.6.4, <= 2) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + orm_adapter (0.5.0) + paperclip (6.1.0) + activemodel (>= 4.2.0) + activesupport (>= 4.2.0) + mime-types + mimemagic (~> 0.3.0) + terrapin (~> 0.6.0) + paranoia (2.4.2) + activerecord (>= 4.0, < 6.1) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) + cliver (~> 0.3.1) + websocket-driver (>= 0.2.0) + polyglot (0.3.5) + premailer (1.11.1) + addressable + css_parser (>= 1.6.0) + htmlentities (>= 4.0.0) + premailer-rails (1.11.1) + actionmailer (>= 3) + premailer (~> 1.7, >= 1.7.9) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.4) + rabl (0.13.1) + activesupport (>= 2.3.14) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (5.2.4.2) + actioncable (= 5.2.4.2) + actionmailer (= 5.2.4.2) + actionpack (= 5.2.4.2) + actionview (= 5.2.4.2) + activejob (= 5.2.4.2) + activemodel (= 5.2.4.2) + activerecord (= 5.2.4.2) + activestorage (= 5.2.4.2) + activesupport (= 5.2.4.2) + bundler (>= 1.3.0) + railties (= 5.2.4.2) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.4) + actionpack (>= 5.0.1.x) + actionview (>= 5.0.1.x) + activesupport (>= 5.0.1.x) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (5.2.4.2) + actionpack (= 5.2.4.2) + activesupport (= 5.2.4.2) + method_source + rake (>= 0.8.7) + thor (>= 0.19.0, < 2.0) + rainbow (3.0.0) + rake (13.0.1) + ransack (2.1.1) + actionpack (>= 5.0) + activerecord (>= 5.0) + activesupport (>= 5.0) + i18n + regexp_parser (1.7.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) + rspec-activemodel-mocks (1.1.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + rspec-mocks (>= 2.99, < 4.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + rubyzip (2.3.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.2.1) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + select2-rails (3.5.9.1) + thor (~> 0.14) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) + simplecov (0.18.5) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) + spree (3.7.10) + spree_api (= 3.7.10) + spree_backend (= 3.7.10) + spree_cmd (= 3.7.10) + spree_core (= 3.7.10) + spree_frontend (= 3.7.10) + spree_sample (= 3.7.10) + spree_api (3.7.10) + doorkeeper (~> 5.0) + fast_jsonapi (~> 1.5) + rabl (~> 0.13.1) + spree_core (= 3.7.10) + versioncake (~> 3.4.0) + spree_auth_devise (3.5.2) + devise (>= 4.4, < 4.7) + devise-encryptable (= 0.2.0) + spree_core (>= 3.1.0, < 4.0) + spree_extension + spree_backend (3.7.10) + bootstrap-sass (~> 3.4) + jquery-rails (~> 4.3) + jquery-ui-rails (~> 6.0.1) + select2-rails (= 3.5.9.1) + spree_api (= 3.7.10) + spree_core (= 3.7.10) + spree_cmd (3.7.10) + thor (~> 0.14) + spree_core (3.7.10) + activemerchant (~> 1.67) + acts-as-taggable-on (~> 6.0.0) + acts_as_list (~> 0.8) + awesome_nested_set (~> 3.2.0) + cancancan (~> 2.0) + carmen (~> 1.0.0) + deface (~> 1.0) + ffaker (~> 2.9) + friendly_id (~> 5.2.1) + highline (~> 2.0.0) + kaminari (~> 1.0.1) + mini_magick (~> 4.9.4) + monetize (~> 1.9) + money (~> 6.13) + paperclip (~> 6.1.0) + paranoia (~> 2.4.1) + premailer-rails + rails (~> 5.2.4, >= 5.2.4) + ransack (~> 2.1.1) + responders + sprockets (~> 3.7) + sprockets-rails + state_machines-activerecord (~> 0.5) + stringex + twitter_cldr (~> 4.3) + spree_extension (0.0.9) + activerecord (>= 4.2) + spree_core + spree_frontend (3.7.10) + bootstrap-sass (~> 3.4) + canonical-rails (~> 0.2.3) + jquery-rails (~> 4.3) + spree_api (= 3.7.10) + spree_core (= 3.7.10) + spree_sample (3.7.10) + spree_core (= 3.7.10) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + state_machines (0.5.0) + state_machines-activemodel (0.7.1) + activemodel (>= 4.1) + state_machines (>= 0.5.0) + state_machines-activerecord (0.6.0) + activerecord (>= 4.1) + state_machines-activemodel (>= 0.5.0) + stringex (2.8.5) + terrapin (0.6.0) + climate_control (>= 0.0.3, < 1.0) + thor (0.20.3) + thread_safe (0.3.6) + tilt (2.0.10) + twitter_cldr (4.4.5) + camertron-eprun + cldr-plurals-runtime-rb (~> 1.0) + tzinfo + tzinfo (1.2.7) + thread_safe (~> 0.1) + versioncake (3.4.0) + actionpack (>= 3.2) + activesupport (>= 3.2) + railties (>= 3.2) + tzinfo + warden (1.2.8) + rack (>= 2.0.6) + websocket-driver (0.7.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) + xpath (3.2.0) + nokogiri (~> 1.8) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + byebug + capybara + coffee-rails + database_cleaner + factory_girl_rails + ffaker + launchy + poltergeist + pry + rails-controller-testing + rspec-activemodel-mocks + rspec-rails (~> 3.5.0) + sass-rails + selenium-webdriver + shoulda-matchers (~> 3.1) + simplecov + spree (~> 3.7.0) + spree_admin_roles_and_access! + spree_auth_devise (~> 3.5.0) + sqlite3 + +BUNDLED WITH + 2.1.4 diff --git a/gemfiles/spree_4_0.gemfile b/gemfiles/spree_4_0.gemfile new file mode 100644 index 0000000..67db5ae --- /dev/null +++ b/gemfiles/spree_4_0.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "spree", "~> 4.0.0" +gem "spree_auth_devise" + +gemspec path: "../" diff --git a/gemfiles/spree_4_0.gemfile.lock b/gemfiles/spree_4_0.gemfile.lock new file mode 100644 index 0000000..e131853 --- /dev/null +++ b/gemfiles/spree_4_0.gemfile.lock @@ -0,0 +1,439 @@ +PATH + remote: .. + specs: + spree_admin_roles_and_access (3.pre.0.pre.stable) + spree_auth_devise + spree_core (>= 3.7.0, < 5.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.2.2) + actionpack (= 6.0.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + mail (>= 2.7.1) + actionmailer (6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.2) + actionpack (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + nokogiri (>= 1.8.5) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.2) + activesupport (= 6.0.2.2) + globalid (>= 0.3.6) + activemerchant (1.107.1) + activesupport (>= 4.2) + builder (>= 2.1.2, < 4.0.0) + i18n (>= 0.6.9) + nokogiri (~> 1.4) + activemodel (6.0.2.2) + activesupport (= 6.0.2.2) + activerecord (6.0.2.2) + activemodel (= 6.0.2.2) + activesupport (= 6.0.2.2) + activestorage (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + marcel (~> 0.3.1) + activesupport (6.0.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2) + acts_as_list (0.9.19) + activerecord (>= 3.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + autoprefixer-rails (9.7.6) + execjs + awesome_nested_set (3.2.0) + activerecord (>= 4.0.0, < 7.0) + bcrypt (3.1.13) + bootstrap (4.3.1) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 1.14.3, < 2) + sassc-rails (>= 2.0.0) + builder (3.2.4) + byebug (11.1.1) + camertron-eprun (1.1.1) + cancancan (3.1.0) + canonical-rails (0.2.8) + rails (>= 4.1, < 6.1) + capybara (3.32.1) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) + carmen (1.1.3) + activesupport (>= 3.0.0) + childprocess (3.0.0) + cldr-plurals-runtime-rb (1.0.1) + cliver (0.3.2) + coderay (1.1.2) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.6) + crass (1.0.6) + css_parser (1.7.1) + addressable + database_cleaner (1.8.4) + deface (1.5.3) + nokogiri (>= 1.6) + polyglot + rails (>= 4.1) + rainbow (>= 2.1.0) + devise (4.7.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + devise-encryptable (0.2.0) + devise (>= 2.1.0) + diff-lcs (1.3) + docile (1.3.2) + doorkeeper (5.3.1) + railties (>= 5) + erubi (1.9.0) + execjs (2.7.0) + factory_girl (4.9.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) + railties (>= 3.0.0) + fast_jsonapi (1.5) + activesupport (>= 4.2) + ffaker (2.14.0) + ffi (1.12.2) + friendly_id (5.3.0) + activerecord (>= 4.0.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + glyphicons (1.0.2) + highline (2.0.3) + htmlentities (4.3.4) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + image_processing (1.10.3) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + jquery-rails (4.3.5) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (6.0.1) + railties (>= 3.2.16) + kaminari (1.1.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) + actionview + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) + activerecord + kaminari-core (= 1.1.1) + kaminari-core (1.1.1) + launchy (2.5.0) + addressable (~> 2.7) + loofah (2.5.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mimemagic (0.3.4) + mini_magick (4.9.5) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + monetize (1.9.4) + money (~> 6.12) + money (6.13.7) + i18n (>= 0.6.4, <= 2) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + orm_adapter (0.5.0) + paranoia (2.4.2) + activerecord (>= 4.0, < 6.1) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) + cliver (~> 0.3.1) + websocket-driver (>= 0.2.0) + polyamorous (2.3.2) + activerecord (>= 5.2.1) + polyglot (0.3.5) + popper_js (1.16.0) + premailer (1.11.1) + addressable + css_parser (>= 1.6.0) + htmlentities (>= 4.0.0) + premailer-rails (1.11.1) + actionmailer (>= 3) + premailer (~> 1.7, >= 1.7.9) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.4) + rabl (0.14.2) + activesupport (>= 2.3.14) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.2.2) + actioncable (= 6.0.2.2) + actionmailbox (= 6.0.2.2) + actionmailer (= 6.0.2.2) + actionpack (= 6.0.2.2) + actiontext (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + activemodel (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + bundler (>= 1.3.0) + railties (= 6.0.2.2) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.4) + actionpack (>= 5.0.1.x) + actionview (>= 5.0.1.x) + activesupport (>= 5.0.1.x) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rainbow (3.0.0) + rake (13.0.1) + ransack (2.3.2) + activerecord (>= 5.2.1) + activesupport (>= 5.2.1) + i18n + polyamorous (= 2.3.2) + regexp_parser (1.7.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) + rspec-activemodel-mocks (1.1.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + rspec-mocks (>= 2.99, < 4.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + ruby-vips (2.0.17) + ffi (~> 1.9) + rubyzip (2.3.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.2.1) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + select2-rails (3.5.9.1) + thor (~> 0.14) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) + simplecov (0.18.5) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) + spree (4.0.3) + spree_api (= 4.0.3) + spree_backend (= 4.0.3) + spree_cmd (= 4.0.3) + spree_core (= 4.0.3) + spree_frontend (= 4.0.3) + spree_sample (= 4.0.3) + spree_api (4.0.3) + doorkeeper (~> 5.2, >= 5.2.1) + fast_jsonapi (~> 1.5) + rabl (~> 0.14.2) + spree_core (= 4.0.3) + spree_auth_devise (4.0.0) + deface (~> 1.0) + devise (~> 4.7) + devise-encryptable (= 0.2.0) + spree_core (>= 3.1.0, < 5.0) + spree_extension + spree_backend (4.0.3) + bootstrap (~> 4.3.1) + glyphicons (~> 1.0.2) + jquery-rails (~> 4.3) + jquery-ui-rails (~> 6.0.1) + select2-rails (= 3.5.9.1) + spree_api (= 4.0.3) + spree_core (= 4.0.3) + spree_cmd (4.0.3) + thor (~> 0.14) + spree_core (4.0.3) + activemerchant (~> 1.67) + acts_as_list (~> 0.8) + awesome_nested_set (>= 3.1.4, < 3.3.0) + cancancan (~> 3.0) + carmen (>= 1.0, < 1.2) + ffaker (~> 2.9) + friendly_id (>= 5.2.1, < 5.4.0) + highline (~> 2.0.0) + image_processing (~> 1.2) + kaminari (>= 1.0.1, < 1.2.0) + mini_magick (~> 4.9.4) + monetize (~> 1.9) + money (~> 6.13) + paranoia (~> 2.4.2) + premailer-rails + rails (~> 6.0.0) + ransack (~> 2.3.0) + responders + sprockets (~> 3.7) + sprockets-rails + state_machines-activemodel (~> 0.7) + state_machines-activerecord (~> 0.6) + stringex + twitter_cldr (~> 4.3) + spree_extension (0.0.9) + activerecord (>= 4.2) + spree_core + spree_frontend (4.0.3) + bootstrap (~> 4.3.1) + canonical-rails (~> 0.2.5) + glyphicons (~> 1.0.2) + jquery-rails (~> 4.3) + spree_api (= 4.0.3) + spree_core (= 4.0.3) + spree_sample (4.0.3) + spree_core (= 4.0.3) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + state_machines (0.5.0) + state_machines-activemodel (0.7.1) + activemodel (>= 4.1) + state_machines (>= 0.5.0) + state_machines-activerecord (0.6.0) + activerecord (>= 4.1) + state_machines-activemodel (>= 0.5.0) + stringex (2.8.5) + thor (0.20.3) + thread_safe (0.3.6) + tilt (2.0.10) + twitter_cldr (4.4.5) + camertron-eprun + cldr-plurals-runtime-rb (~> 1.0) + tzinfo + tzinfo (1.2.7) + thread_safe (~> 0.1) + warden (1.2.8) + rack (>= 2.0.6) + websocket-driver (0.7.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + byebug + capybara + coffee-rails + database_cleaner + factory_girl_rails + ffaker + launchy + poltergeist + pry + rails-controller-testing + rspec-activemodel-mocks + rspec-rails (~> 3.5.0) + sass-rails + selenium-webdriver + shoulda-matchers (~> 3.1) + simplecov + spree (~> 4.0.0) + spree_admin_roles_and_access! + spree_auth_devise + sqlite3 + +BUNDLED WITH + 2.1.4 diff --git a/gemfiles/spree_4_1.gemfile b/gemfiles/spree_4_1.gemfile new file mode 100644 index 0000000..a1da1cf --- /dev/null +++ b/gemfiles/spree_4_1.gemfile @@ -0,0 +1,8 @@ +# This file was generated by Appraisal + +source "https://rubygems.org" + +gem "spree", "~> 4.1.0" +gem "spree_auth_devise" + +gemspec path: "../" diff --git a/gemfiles/spree_4_1.gemfile.lock b/gemfiles/spree_4_1.gemfile.lock new file mode 100644 index 0000000..c05c00c --- /dev/null +++ b/gemfiles/spree_4_1.gemfile.lock @@ -0,0 +1,447 @@ +PATH + remote: .. + specs: + spree_admin_roles_and_access (3.pre.0.pre.stable) + spree_auth_devise + spree_core (>= 3.7.0, < 5.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.2.2) + actionpack (= 6.0.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + mail (>= 2.7.1) + actionmailer (6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.2) + actionpack (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + nokogiri (>= 1.8.5) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.2) + activesupport (= 6.0.2.2) + globalid (>= 0.3.6) + activemerchant (1.107.1) + activesupport (>= 4.2) + builder (>= 2.1.2, < 4.0.0) + i18n (>= 0.6.9) + nokogiri (~> 1.4) + activemodel (6.0.2.2) + activesupport (= 6.0.2.2) + activerecord (6.0.2.2) + activemodel (= 6.0.2.2) + activesupport (= 6.0.2.2) + activestorage (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + marcel (~> 0.3.1) + activesupport (6.0.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2) + acts_as_list (0.9.19) + activerecord (>= 3.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + autoprefixer-rails (9.7.6) + execjs + awesome_nested_set (3.2.0) + activerecord (>= 4.0.0, < 7.0) + bcrypt (3.1.13) + bootstrap (4.3.1) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 1.14.3, < 2) + sassc-rails (>= 2.0.0) + builder (3.2.4) + byebug (11.1.1) + camertron-eprun (1.1.1) + cancancan (3.1.0) + canonical-rails (0.2.8) + rails (>= 4.1, < 6.1) + capybara (3.32.1) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) + carmen (1.1.3) + activesupport (>= 3.0.0) + childprocess (3.0.0) + cldr-plurals-runtime-rb (1.0.1) + cliver (0.3.2) + coderay (1.1.2) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.6) + crass (1.0.6) + css_parser (1.7.1) + addressable + database_cleaner (1.8.4) + deface (1.5.3) + nokogiri (>= 1.6) + polyglot + rails (>= 4.1) + rainbow (>= 2.1.0) + devise (4.7.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + devise-encryptable (0.2.0) + devise (>= 2.1.0) + diff-lcs (1.3) + docile (1.3.2) + doorkeeper (5.3.1) + railties (>= 5) + erubi (1.9.0) + execjs (2.7.0) + factory_girl (4.9.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) + railties (>= 3.0.0) + fast_jsonapi (1.5) + activesupport (>= 4.2) + ffaker (2.14.0) + ffi (1.12.2) + friendly_id (5.3.0) + activerecord (>= 4.0.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + glyphicons (1.0.2) + highline (2.0.3) + htmlentities (4.3.4) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + image_processing (1.10.3) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + inline_svg (1.7.1) + activesupport (>= 3.0) + nokogiri (>= 1.6) + jquery-rails (4.3.5) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (6.0.1) + railties (>= 3.2.16) + kaminari (1.1.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) + actionview + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) + activerecord + kaminari-core (= 1.1.1) + kaminari-core (1.1.1) + launchy (2.5.0) + addressable (~> 2.7) + loofah (2.5.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mimemagic (0.3.4) + mini_magick (4.10.1) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + monetize (1.9.4) + money (~> 6.12) + money (6.13.7) + i18n (>= 0.6.4, <= 2) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + orm_adapter (0.5.0) + paranoia (2.4.2) + activerecord (>= 4.0, < 6.1) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) + cliver (~> 0.3.1) + websocket-driver (>= 0.2.0) + polyamorous (2.3.2) + activerecord (>= 5.2.1) + polyglot (0.3.5) + popper_js (1.16.0) + premailer (1.11.1) + addressable + css_parser (>= 1.6.0) + htmlentities (>= 4.0.0) + premailer-rails (1.11.1) + actionmailer (>= 3) + premailer (~> 1.7, >= 1.7.9) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.4) + rabl (0.14.2) + activesupport (>= 2.3.14) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.2.2) + actioncable (= 6.0.2.2) + actionmailbox (= 6.0.2.2) + actionmailer (= 6.0.2.2) + actionpack (= 6.0.2.2) + actiontext (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + activemodel (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + bundler (>= 1.3.0) + railties (= 6.0.2.2) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.4) + actionpack (>= 5.0.1.x) + actionview (>= 5.0.1.x) + activesupport (>= 5.0.1.x) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rainbow (3.0.0) + rake (13.0.1) + ransack (2.3.2) + activerecord (>= 5.2.1) + activesupport (>= 5.2.1) + i18n + polyamorous (= 2.3.2) + regexp_parser (1.7.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) + rspec-activemodel-mocks (1.1.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + rspec-mocks (>= 2.99, < 4.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + ruby-vips (2.0.17) + ffi (~> 1.9) + rubyzip (2.3.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.2.1) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + select2-rails (3.5.10) + thor (~> 0.14) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) + simplecov (0.18.5) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) + spree (4.1.5) + spree_api (= 4.1.5) + spree_backend (= 4.1.5) + spree_cmd (= 4.1.5) + spree_core (= 4.1.5) + spree_frontend (= 4.1.5) + spree_sample (= 4.1.5) + spree_api (4.1.5) + doorkeeper (~> 5.2, >= 5.2.1) + fast_jsonapi (~> 1.5) + rabl (~> 0.14.2) + spree_core (= 4.1.5) + spree_auth_devise (4.1.0) + deface (~> 1.0) + devise (~> 4.7) + devise-encryptable (= 0.2.0) + spree_core (>= 4.1.0.alpha, < 5.0) + spree_extension + spree_backend (4.1.5) + bootstrap (~> 4.3.1) + glyphicons (~> 1.0.2) + jquery-rails (~> 4.3) + jquery-ui-rails (~> 6.0.1) + select2-rails (~> 3.5.0) + spree_api (= 4.1.5) + spree_core (= 4.1.5) + spree_cmd (4.1.5) + thor (>= 0.14, < 2.0) + spree_core (4.1.5) + activemerchant (~> 1.67) + acts_as_list (~> 0.8) + awesome_nested_set (>= 3.1.4, < 3.3.0) + cancancan (~> 3.0) + carmen (>= 1.0, < 1.2) + ffaker (~> 2.9) + friendly_id (>= 5.2.1, < 5.4.0) + highline (~> 2.0.0) + image_processing (~> 1.2) + kaminari (>= 1.0.1, < 1.2.0) + mini_magick (>= 4.9.4, < 4.11.0) + monetize (~> 1.9) + money (~> 6.13) + paranoia (~> 2.4.2) + premailer-rails + rails (~> 6.0.0) + ransack (~> 2.3.0) + responders + sprockets (~> 3.7) + sprockets-rails + state_machines-activemodel (~> 0.7) + state_machines-activerecord (~> 0.6) + stringex + twitter_cldr (>= 4.3, < 6.0) + spree_extension (0.0.9) + activerecord (>= 4.2) + spree_core + spree_frontend (4.1.5) + bootstrap (~> 4.3.1) + canonical-rails (~> 0.2.5) + glyphicons (~> 1.0.2) + inline_svg (~> 1.5) + jquery-rails (~> 4.3) + spree_api (= 4.1.5) + spree_core (= 4.1.5) + turbolinks (~> 5.2.0) + spree_sample (4.1.5) + spree_core (= 4.1.5) + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + state_machines (0.5.0) + state_machines-activemodel (0.7.1) + activemodel (>= 4.1) + state_machines (>= 0.5.0) + state_machines-activerecord (0.6.0) + activerecord (>= 4.1) + state_machines-activemodel (>= 0.5.0) + stringex (2.8.5) + thor (0.20.3) + thread_safe (0.3.6) + tilt (2.0.10) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + twitter_cldr (5.4.0) + camertron-eprun + cldr-plurals-runtime-rb (~> 1.0) + tzinfo + tzinfo (1.2.7) + thread_safe (~> 0.1) + warden (1.2.8) + rack (>= 2.0.6) + websocket-driver (0.7.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + byebug + capybara + coffee-rails + database_cleaner + factory_girl_rails + ffaker + launchy + poltergeist + pry + rails-controller-testing + rspec-activemodel-mocks + rspec-rails (~> 3.5.0) + sass-rails + selenium-webdriver + shoulda-matchers (~> 3.1) + simplecov + spree (~> 4.1.0) + spree_admin_roles_and_access! + spree_auth_devise + sqlite3 + +BUNDLED WITH + 2.1.4 diff --git a/gemfiles/spree_master.gemfile.lock b/gemfiles/spree_master.gemfile.lock new file mode 100644 index 0000000..bd85c0b --- /dev/null +++ b/gemfiles/spree_master.gemfile.lock @@ -0,0 +1,459 @@ +GIT + remote: https://github.com/spree/spree.git + revision: 82c64b2f3e6a350938fd590c5fecc8d38c5c1c6a + branch: master + specs: + spree (4.2.0.alpha) + spree_api (= 4.2.0.alpha) + spree_backend (= 4.2.0.alpha) + spree_cmd (= 4.2.0.alpha) + spree_core (= 4.2.0.alpha) + spree_frontend (= 4.2.0.alpha) + spree_sample (= 4.2.0.alpha) + spree_api (4.2.0.alpha) + doorkeeper (~> 5.2, >= 5.2.1) + fast_jsonapi (~> 1.5) + rabl (~> 0.14.2) + spree_core (= 4.2.0.alpha) + spree_backend (4.2.0.alpha) + bootstrap (~> 4.3.1) + glyphicons (~> 1.0.2) + jquery-rails (~> 4.3) + jquery-ui-rails (~> 6.0.1) + select2-rails (~> 3.5.0) + spree_api (= 4.2.0.alpha) + spree_core (= 4.2.0.alpha) + spree_cmd (4.2.0.alpha) + thor (>= 0.14, < 2.0) + spree_core (4.2.0.alpha) + activemerchant (~> 1.67) + acts_as_list (~> 0.8) + awesome_nested_set (>= 3.1.4, < 3.3.0) + cancancan (~> 3.0) + carmen (>= 1.0, < 1.2) + ffaker (~> 2.9) + friendly_id (>= 5.2.1, < 5.4.0) + highline (~> 2.0.0) + image_processing (~> 1.2) + kaminari (>= 1.0.1, < 1.2.0) + mini_magick (>= 4.9.4, < 4.11.0) + monetize (~> 1.9) + money (~> 6.13) + paranoia (~> 2.4.2) + premailer-rails + rails (~> 6.0.0) + ransack (~> 2.3.0) + responders + sprockets (~> 3.7) + sprockets-rails + state_machines-activemodel (~> 0.7) + state_machines-activerecord (~> 0.6) + stringex + twitter_cldr (>= 4.3, < 6.0) + spree_frontend (4.2.0.alpha) + bootstrap (~> 4.3.1) + canonical-rails (~> 0.2.5) + glyphicons (~> 1.0.2) + inline_svg (~> 1.5) + jquery-rails (~> 4.3) + spree_api (= 4.2.0.alpha) + spree_core (= 4.2.0.alpha) + turbolinks (~> 5.2.0) + spree_sample (4.2.0.alpha) + spree_core (= 4.2.0.alpha) + +GIT + remote: https://github.com/spree/spree_auth_devise.git + revision: 348192110bee0b18a317322a5ebf94f7726a545b + branch: master + specs: + spree_auth_devise (4.1.0) + deface (~> 1.0) + devise (~> 4.7) + devise-encryptable (= 0.2.0) + spree_core (>= 4.1.0.alpha, < 5.0) + spree_extension + +PATH + remote: .. + specs: + spree_admin_roles_and_access (3.pre.0.pre.stable) + spree_auth_devise + spree_core (>= 3.7.0, < 5.0.0) + +GEM + remote: https://rubygems.org/ + specs: + actioncable (6.0.2.2) + actionpack (= 6.0.2.2) + nio4r (~> 2.0) + websocket-driver (>= 0.6.1) + actionmailbox (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + mail (>= 2.7.1) + actionmailer (6.0.2.2) + actionpack (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + mail (~> 2.5, >= 2.5.4) + rails-dom-testing (~> 2.0) + actionpack (6.0.2.2) + actionview (= 6.0.2.2) + activesupport (= 6.0.2.2) + rack (~> 2.0, >= 2.0.8) + rack-test (>= 0.6.3) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.0, >= 1.2.0) + actiontext (6.0.2.2) + actionpack (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + nokogiri (>= 1.8.5) + actionview (6.0.2.2) + activesupport (= 6.0.2.2) + builder (~> 3.1) + erubi (~> 1.4) + rails-dom-testing (~> 2.0) + rails-html-sanitizer (~> 1.1, >= 1.2.0) + activejob (6.0.2.2) + activesupport (= 6.0.2.2) + globalid (>= 0.3.6) + activemerchant (1.107.1) + activesupport (>= 4.2) + builder (>= 2.1.2, < 4.0.0) + i18n (>= 0.6.9) + nokogiri (~> 1.4) + activemodel (6.0.2.2) + activesupport (= 6.0.2.2) + activerecord (6.0.2.2) + activemodel (= 6.0.2.2) + activesupport (= 6.0.2.2) + activestorage (6.0.2.2) + actionpack (= 6.0.2.2) + activejob (= 6.0.2.2) + activerecord (= 6.0.2.2) + marcel (~> 0.3.1) + activesupport (6.0.2.2) + concurrent-ruby (~> 1.0, >= 1.0.2) + i18n (>= 0.7, < 2) + minitest (~> 5.1) + tzinfo (~> 1.1) + zeitwerk (~> 2.2) + acts_as_list (0.9.19) + activerecord (>= 3.0) + addressable (2.7.0) + public_suffix (>= 2.0.2, < 5.0) + appraisal (2.2.0) + bundler + rake + thor (>= 0.14.0) + autoprefixer-rails (9.7.6) + execjs + awesome_nested_set (3.2.0) + activerecord (>= 4.0.0, < 7.0) + bcrypt (3.1.13) + bootstrap (4.3.1) + autoprefixer-rails (>= 9.1.0) + popper_js (>= 1.14.3, < 2) + sassc-rails (>= 2.0.0) + builder (3.2.4) + byebug (11.1.1) + camertron-eprun (1.1.1) + cancancan (3.1.0) + canonical-rails (0.2.8) + rails (>= 4.1, < 6.1) + capybara (3.32.1) + addressable + mini_mime (>= 0.1.3) + nokogiri (~> 1.8) + rack (>= 1.6.0) + rack-test (>= 0.6.3) + regexp_parser (~> 1.5) + xpath (~> 3.2) + carmen (1.1.3) + activesupport (>= 3.0.0) + childprocess (3.0.0) + cldr-plurals-runtime-rb (1.0.1) + cliver (0.3.2) + coderay (1.1.2) + coffee-rails (5.0.0) + coffee-script (>= 2.2.0) + railties (>= 5.2.0) + coffee-script (2.4.1) + coffee-script-source + execjs + coffee-script-source (1.12.2) + concurrent-ruby (1.1.6) + crass (1.0.6) + css_parser (1.7.1) + addressable + database_cleaner (1.8.4) + deface (1.5.3) + nokogiri (>= 1.6) + polyglot + rails (>= 4.1) + rainbow (>= 2.1.0) + devise (4.7.1) + bcrypt (~> 3.0) + orm_adapter (~> 0.1) + railties (>= 4.1.0) + responders + warden (~> 1.2.3) + devise-encryptable (0.2.0) + devise (>= 2.1.0) + diff-lcs (1.3) + docile (1.3.2) + doorkeeper (5.3.1) + railties (>= 5) + erubi (1.9.0) + execjs (2.7.0) + factory_girl (4.9.0) + activesupport (>= 3.0.0) + factory_girl_rails (4.9.0) + factory_girl (~> 4.9.0) + railties (>= 3.0.0) + fast_jsonapi (1.5) + activesupport (>= 4.2) + ffaker (2.14.0) + ffi (1.12.2) + friendly_id (5.3.0) + activerecord (>= 4.0.0) + globalid (0.4.2) + activesupport (>= 4.2.0) + glyphicons (1.0.2) + highline (2.0.3) + htmlentities (4.3.4) + i18n (1.8.2) + concurrent-ruby (~> 1.0) + image_processing (1.10.3) + mini_magick (>= 4.9.5, < 5) + ruby-vips (>= 2.0.17, < 3) + inline_svg (1.7.1) + activesupport (>= 3.0) + nokogiri (>= 1.6) + jquery-rails (4.3.5) + rails-dom-testing (>= 1, < 3) + railties (>= 4.2.0) + thor (>= 0.14, < 2.0) + jquery-ui-rails (6.0.1) + railties (>= 3.2.16) + kaminari (1.1.1) + activesupport (>= 4.1.0) + kaminari-actionview (= 1.1.1) + kaminari-activerecord (= 1.1.1) + kaminari-core (= 1.1.1) + kaminari-actionview (1.1.1) + actionview + kaminari-core (= 1.1.1) + kaminari-activerecord (1.1.1) + activerecord + kaminari-core (= 1.1.1) + kaminari-core (1.1.1) + launchy (2.5.0) + addressable (~> 2.7) + loofah (2.5.0) + crass (~> 1.0.2) + nokogiri (>= 1.5.9) + mail (2.7.1) + mini_mime (>= 0.1.1) + marcel (0.3.3) + mimemagic (~> 0.3.2) + method_source (1.0.0) + mimemagic (0.3.4) + mini_magick (4.10.1) + mini_mime (1.0.2) + mini_portile2 (2.4.0) + minitest (5.14.0) + monetize (1.9.4) + money (~> 6.12) + money (6.13.7) + i18n (>= 0.6.4, <= 2) + nio4r (2.5.2) + nokogiri (1.10.9) + mini_portile2 (~> 2.4.0) + orm_adapter (0.5.0) + paranoia (2.4.2) + activerecord (>= 4.0, < 6.1) + poltergeist (1.18.1) + capybara (>= 2.1, < 4) + cliver (~> 0.3.1) + websocket-driver (>= 0.2.0) + polyamorous (2.3.2) + activerecord (>= 5.2.1) + polyglot (0.3.5) + popper_js (1.16.0) + premailer (1.11.1) + addressable + css_parser (>= 1.6.0) + htmlentities (>= 4.0.0) + premailer-rails (1.11.1) + actionmailer (>= 3) + premailer (~> 1.7, >= 1.7.9) + pry (0.13.1) + coderay (~> 1.1) + method_source (~> 1.0) + public_suffix (4.0.4) + rabl (0.14.2) + activesupport (>= 2.3.14) + rack (2.2.2) + rack-test (1.1.0) + rack (>= 1.0, < 3) + rails (6.0.2.2) + actioncable (= 6.0.2.2) + actionmailbox (= 6.0.2.2) + actionmailer (= 6.0.2.2) + actionpack (= 6.0.2.2) + actiontext (= 6.0.2.2) + actionview (= 6.0.2.2) + activejob (= 6.0.2.2) + activemodel (= 6.0.2.2) + activerecord (= 6.0.2.2) + activestorage (= 6.0.2.2) + activesupport (= 6.0.2.2) + bundler (>= 1.3.0) + railties (= 6.0.2.2) + sprockets-rails (>= 2.0.0) + rails-controller-testing (1.0.4) + actionpack (>= 5.0.1.x) + actionview (>= 5.0.1.x) + activesupport (>= 5.0.1.x) + rails-dom-testing (2.0.3) + activesupport (>= 4.2.0) + nokogiri (>= 1.6) + rails-html-sanitizer (1.3.0) + loofah (~> 2.3) + railties (6.0.2.2) + actionpack (= 6.0.2.2) + activesupport (= 6.0.2.2) + method_source + rake (>= 0.8.7) + thor (>= 0.20.3, < 2.0) + rainbow (3.0.0) + rake (13.0.1) + ransack (2.3.2) + activerecord (>= 5.2.1) + activesupport (>= 5.2.1) + i18n + polyamorous (= 2.3.2) + regexp_parser (1.7.0) + responders (3.0.0) + actionpack (>= 5.0) + railties (>= 5.0) + rspec-activemodel-mocks (1.1.0) + activemodel (>= 3.0) + activesupport (>= 3.0) + rspec-mocks (>= 2.99, < 4.0) + rspec-core (3.5.4) + rspec-support (~> 3.5.0) + rspec-expectations (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-mocks (3.5.0) + diff-lcs (>= 1.2.0, < 2.0) + rspec-support (~> 3.5.0) + rspec-rails (3.5.2) + actionpack (>= 3.0) + activesupport (>= 3.0) + railties (>= 3.0) + rspec-core (~> 3.5.0) + rspec-expectations (~> 3.5.0) + rspec-mocks (~> 3.5.0) + rspec-support (~> 3.5.0) + rspec-support (3.5.0) + ruby-vips (2.0.17) + ffi (~> 1.9) + rubyzip (2.3.0) + sass-rails (6.0.0) + sassc-rails (~> 2.1, >= 2.1.1) + sassc (2.2.1) + ffi (~> 1.9) + sassc-rails (2.1.2) + railties (>= 4.0.0) + sassc (>= 2.0) + sprockets (> 3.0) + sprockets-rails + tilt + select2-rails (3.5.10) + thor (~> 0.14) + selenium-webdriver (3.142.7) + childprocess (>= 0.5, < 4.0) + rubyzip (>= 1.2.2) + shoulda-matchers (3.1.3) + activesupport (>= 4.0.0) + simplecov (0.18.5) + docile (~> 1.1) + simplecov-html (~> 0.11) + simplecov-html (0.12.2) + spree_extension (0.0.9) + activerecord (>= 4.2) + spree_core + sprockets (3.7.2) + concurrent-ruby (~> 1.0) + rack (> 1, < 3) + sprockets-rails (3.2.1) + actionpack (>= 4.0) + activesupport (>= 4.0) + sprockets (>= 3.0.0) + sqlite3 (1.4.2) + state_machines (0.5.0) + state_machines-activemodel (0.7.1) + activemodel (>= 4.1) + state_machines (>= 0.5.0) + state_machines-activerecord (0.6.0) + activerecord (>= 4.1) + state_machines-activemodel (>= 0.5.0) + stringex (2.8.5) + thor (0.20.3) + thread_safe (0.3.6) + tilt (2.0.10) + turbolinks (5.2.1) + turbolinks-source (~> 5.2) + turbolinks-source (5.2.0) + twitter_cldr (5.4.0) + camertron-eprun + cldr-plurals-runtime-rb (~> 1.0) + tzinfo + tzinfo (1.2.7) + thread_safe (~> 0.1) + warden (1.2.8) + rack (>= 2.0.6) + websocket-driver (0.7.1) + websocket-extensions (>= 0.1.0) + websocket-extensions (0.1.4) + xpath (3.2.0) + nokogiri (~> 1.8) + zeitwerk (2.3.0) + +PLATFORMS + ruby + +DEPENDENCIES + appraisal + byebug + capybara + coffee-rails + database_cleaner + factory_girl_rails + ffaker + launchy + poltergeist + pry + rails-controller-testing + rspec-activemodel-mocks + rspec-rails (~> 3.5.0) + sass-rails + selenium-webdriver + shoulda-matchers (~> 3.1) + simplecov + spree! + spree_admin_roles_and_access! + spree_auth_devise! + sqlite3 + +BUNDLED WITH + 2.1.4 diff --git a/lib/spree/permissions.rb b/lib/spree/permissions.rb index f214d75..c13fdac 100644 --- a/lib/spree/permissions.rb +++ b/lib/spree/permissions.rb @@ -25,11 +25,11 @@ def method_missing(name, *args, &block) current_ability.can :create, Spree::Order current_ability.can :read, Spree::Order, [] do |order, token| - order.user == user || (order.guest_token && token == order.guest_token) + order.user == user || (order_token(order) && token == order_token(order)) end current_ability.can :update, Spree::Order do |order, token| - !order.completed? && (order.user == user || order.guest_token && token == order.guest_token) + !order.completed? && (order.user == user || order_token(order) && token == order_token(order)) end current_ability.can :read, Spree::Address do |address| @@ -75,5 +75,9 @@ def find_action_and_subject(name) return can.to_sym, action.to_sym, subject, attribute.try(:to_sym) end end + + def order_token(order) + order.respond_to?(:token) ? order.token : order.guest_token + end end end diff --git a/lib/spree_admin_roles_and_access/engine.rb b/lib/spree_admin_roles_and_access/engine.rb index 8bb91d0..bf32408 100644 --- a/lib/spree_admin_roles_and_access/engine.rb +++ b/lib/spree_admin_roles_and_access/engine.rb @@ -2,9 +2,10 @@ module SpreeAdminRolesAndAccess class Engine < Rails::Engine require 'spree/core' isolate_namespace Spree + isolate_namespace SpreeAdminRolesAndAccess engine_name 'spree_admin_roles_and_access' - config.autoload_paths += %W(#{config.root}/lib) + config.autoload_paths += %W(#{config.root}/lib #{config.root}/app) # use rspec for tests config.generators do |g| diff --git a/sample.env b/sample.env new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/.ruby-version b/spec/dummy/.ruby-version new file mode 100644 index 0000000..2eb2fe9 --- /dev/null +++ b/spec/dummy/.ruby-version @@ -0,0 +1 @@ +ruby-2.7.2 diff --git a/spec/dummy/README.md b/spec/dummy/README.md new file mode 100644 index 0000000..7db80e4 --- /dev/null +++ b/spec/dummy/README.md @@ -0,0 +1,24 @@ +# README + +This README would normally document whatever steps are necessary to get the +application up and running. + +Things you may want to cover: + +* Ruby version + +* System dependencies + +* Configuration + +* Database creation + +* Database initialization + +* How to run the test suite + +* Services (job queues, cache servers, search engines, etc.) + +* Deployment instructions + +* ... diff --git a/spec/dummy/Rakefile b/spec/dummy/Rakefile new file mode 100644 index 0000000..9a5ea73 --- /dev/null +++ b/spec/dummy/Rakefile @@ -0,0 +1,6 @@ +# Add your own tasks in files placed in lib/tasks ending in .rake, +# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake. + +require_relative "config/application" + +Rails.application.load_tasks diff --git a/spec/dummy/app/assets/config/manifest.js b/spec/dummy/app/assets/config/manifest.js new file mode 100644 index 0000000..5918193 --- /dev/null +++ b/spec/dummy/app/assets/config/manifest.js @@ -0,0 +1,2 @@ +//= link_tree ../images +//= link_directory ../stylesheets .css diff --git a/spec/dummy/app/assets/images/.keep b/spec/dummy/app/assets/images/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/assets/stylesheets/application.css b/spec/dummy/app/assets/stylesheets/application.css new file mode 100644 index 0000000..288b9ab --- /dev/null +++ b/spec/dummy/app/assets/stylesheets/application.css @@ -0,0 +1,15 @@ +/* + * This is a manifest file that'll be compiled into application.css, which will include all the files + * listed below. + * + * Any CSS (and SCSS, if configured) file within this directory, lib/assets/stylesheets, or any plugin's + * vendor/assets/stylesheets directory can be referenced here using a relative path. + * + * You're free to add application-wide styles to this file and they'll appear at the bottom of the + * compiled file so the styles you add here take precedence over styles defined in any other CSS + * files in this directory. Styles in this file should be added after the last require_* statement. + * It is generally better to create a new file per style scope. + * + *= require_tree . + *= require_self + */ diff --git a/spec/dummy/app/channels/application_cable/channel.rb b/spec/dummy/app/channels/application_cable/channel.rb new file mode 100644 index 0000000..d672697 --- /dev/null +++ b/spec/dummy/app/channels/application_cable/channel.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Channel < ActionCable::Channel::Base + end +end diff --git a/spec/dummy/app/channels/application_cable/connection.rb b/spec/dummy/app/channels/application_cable/connection.rb new file mode 100644 index 0000000..0ff5442 --- /dev/null +++ b/spec/dummy/app/channels/application_cable/connection.rb @@ -0,0 +1,4 @@ +module ApplicationCable + class Connection < ActionCable::Connection::Base + end +end diff --git a/spec/dummy/app/controllers/application_controller.rb b/spec/dummy/app/controllers/application_controller.rb new file mode 100644 index 0000000..09705d1 --- /dev/null +++ b/spec/dummy/app/controllers/application_controller.rb @@ -0,0 +1,2 @@ +class ApplicationController < ActionController::Base +end diff --git a/spec/dummy/app/controllers/concerns/.keep b/spec/dummy/app/controllers/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/helpers/application_helper.rb b/spec/dummy/app/helpers/application_helper.rb new file mode 100644 index 0000000..de6be79 --- /dev/null +++ b/spec/dummy/app/helpers/application_helper.rb @@ -0,0 +1,2 @@ +module ApplicationHelper +end diff --git a/spec/dummy/app/jobs/application_job.rb b/spec/dummy/app/jobs/application_job.rb new file mode 100644 index 0000000..d394c3d --- /dev/null +++ b/spec/dummy/app/jobs/application_job.rb @@ -0,0 +1,7 @@ +class ApplicationJob < ActiveJob::Base + # Automatically retry jobs that encountered a deadlock + # retry_on ActiveRecord::Deadlocked + + # Most jobs are safe to ignore if the underlying records are no longer available + # discard_on ActiveJob::DeserializationError +end diff --git a/spec/dummy/app/mailers/application_mailer.rb b/spec/dummy/app/mailers/application_mailer.rb new file mode 100644 index 0000000..3c34c81 --- /dev/null +++ b/spec/dummy/app/mailers/application_mailer.rb @@ -0,0 +1,4 @@ +class ApplicationMailer < ActionMailer::Base + default from: "from@example.com" + layout "mailer" +end diff --git a/spec/dummy/app/models/application_record.rb b/spec/dummy/app/models/application_record.rb new file mode 100644 index 0000000..b63caeb --- /dev/null +++ b/spec/dummy/app/models/application_record.rb @@ -0,0 +1,3 @@ +class ApplicationRecord < ActiveRecord::Base + primary_abstract_class +end diff --git a/spec/dummy/app/models/concerns/.keep b/spec/dummy/app/models/concerns/.keep new file mode 100644 index 0000000..e69de29 diff --git a/spec/dummy/app/models/spree/dummy_model.rb b/spec/dummy/app/models/spree/dummy_model.rb new file mode 100644 index 0000000..099ad2c --- /dev/null +++ b/spec/dummy/app/models/spree/dummy_model.rb @@ -0,0 +1,6 @@ +module Spree + class DummyModel < Spree::Base + acts_as_list + validates :name, presence: true + end +end diff --git a/spec/dummy/app/views/layouts/application.html.erb b/spec/dummy/app/views/layouts/application.html.erb new file mode 100644 index 0000000..f72b4ef --- /dev/null +++ b/spec/dummy/app/views/layouts/application.html.erb @@ -0,0 +1,15 @@ + + +
+You may have mistyped the address or the page may have moved.
+If you are the application owner check the logs for more information.
+Maybe you tried to change something you didn't have access to.
+If you are the application owner check the logs for more information.
+If you are the application owner check the logs for more information.
+