move to proper module

pull/8696/head
ulferts 4 years ago committed by Oliver Günther
parent c54e895ad4
commit 3b0f7367fd
  1. 2
      app/contracts/work_packages/base_contract.rb
  2. 2
      app/helpers/users_helper.rb
  3. 4
      app/models/user.rb
  4. 2
      app/models/users/inexistent_user.rb
  5. 2
      app/models/users/project_authorization_cache.rb
  6. 2
      app/models/users/project_role_cache.rb
  7. 2
      app/models/users/status_options.rb
  8. 4
      app/services/authorization/user_allowed_service.rb
  9. 2
      modules/bim/app/services/bim/bcf/issues/transform_attributes_service.rb
  10. 2
      spec/contracts/work_packages/base_contract_spec.rb
  11. 2
      spec/services/authorization/user_allowed_service_spec.rb

@ -208,7 +208,7 @@ module WorkPackages
end
def validate_assigned_to_exists
errors.add :assigned_to, :does_not_exist if model.assigned_to&.is_a?(User::InexistentUser)
errors.add :assigned_to, :does_not_exist if model.assigned_to&.is_a?(Users::InexistentUser)
end
def validate_type_exists

@ -35,7 +35,7 @@ module UsersHelper
# @param extra [Hash] A hash containing extra entries with a count for each.
# For example: { random: 42 }
def users_status_options_for_select(selected, extra: {})
statuses = User::StatusOptions.user_statuses_with_count extra: extra
statuses = Users::StatusOptions.user_statuses_with_count extra: extra
options = statuses.map do |sym, count|
["#{translate_user_status(sym)} (#{count})", sym]

@ -207,7 +207,7 @@ class User < Principal
@name = nil
@projects_by_role = nil
@authorization_service = ::Authorization::UserAllowedService.new(self)
@project_role_cache = ::User::ProjectRoleCache.new(self)
@project_role_cache = ::Users::ProjectRoleCache.new(self)
super
end
@ -776,7 +776,7 @@ class User < Principal
end
def project_role_cache
@project_role_cache ||= ::User::ProjectRoleCache.new(self)
@project_role_cache ||= ::Users::ProjectRoleCache.new(self)
end
def former_passwords_include?(password)

@ -28,4 +28,4 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class User::InexistentUser < User; end
class Users::InexistentUser < User; end

@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class User::ProjectAuthorizationCache
class Users::ProjectAuthorizationCache
attr_accessor :user
def initialize(user)

@ -28,7 +28,7 @@
# See docs/COPYRIGHT.rdoc for more details.
#++
class User::ProjectRoleCache
class Users::ProjectRoleCache
attr_accessor :user
def initialize(user)

@ -1,4 +1,4 @@
class User
module Users
module StatusOptions
module_function

@ -31,7 +31,7 @@
class Authorization::UserAllowedService
attr_accessor :user
def initialize(user, role_cache: User::ProjectRoleCache.new(user))
def initialize(user, role_cache: Users::ProjectRoleCache.new(user))
self.user = user
self.project_role_cache = role_cache
end
@ -114,7 +114,7 @@ class Authorization::UserAllowedService
end
def project_authorization_cache
@project_authorization_cache ||= User::ProjectAuthorizationCache.new(user)
@project_authorization_cache ||= Users::ProjectAuthorizationCache.new(user)
end
def normalize_action(action)

@ -160,7 +160,7 @@ module Bim::Bcf
def missing_assignee(assignee_name, import_options)
if import_options[:invalid_people_action] != 'anonymize' && assignee_name
User::InexistentUser.new
Users::InexistentUser.new
end
end
end

@ -664,7 +664,7 @@ describe WorkPackages::BaseContract do
context 'assigned_to' do
context 'inexistent user' do
before do
work_package.assigned_to = User::InexistentUser.new
work_package.assigned_to = Users::InexistentUser.new
contract.validate
end

@ -167,7 +167,7 @@ describe Authorization::UserAllowedService do
before do
auth_cache = double('auth_cache')
allow(User::ProjectAuthorizationCache)
allow(Users::ProjectAuthorizationCache)
.to receive(:new)
.and_return(auth_cache)

Loading…
Cancel
Save