seed project creator role

pull/6827/head
Jens Ulferts 7 years ago
parent f6016afaed
commit 2508183af9
No known key found for this signature in database
GPG Key ID: 3CAA4B1182CF5308
  1. 3
      config/locales/en.yml
  2. 1
      lib/open_project/global_roles/engine.rb
  3. 21
      lib/open_project/global_roles/patches/role_seeder_patch.rb

@ -28,3 +28,6 @@ en:
label_not_changeable: (not changeable)
label_no_assignable_role: No global role available for assignment
label_global: Global
seeders:
default_role_project_creator: 'Project creator'

@ -32,6 +32,7 @@ module OpenProject::GlobalRoles
assets %w(global_roles/global_roles.js)
patches [:Principal, :Role, :User, :RolesController, :UsersController]
patch_with_namespace :BasicData, :RoleSeeder
initializer 'patch helper' do
require_relative 'patches/roles_helper_patch'

@ -0,0 +1,21 @@
module OpenProject::GlobalRoles::Patches
module RoleSeederPatch
def self.included(base)
base.prepend InstanceMethods
end
module InstanceMethods
def roles
super + [project_creator]
end
def project_creator
{ name: I18n.t(:'seeders.default_role_project_creator'),
position: 6,
permissions: [:add_project],
type: 'GlobalRole'
}
end
end
end
end
Loading…
Cancel
Save