|
|
@ -19,6 +19,8 @@ module Redmine |
|
|
|
yield mapper |
|
|
|
yield mapper |
|
|
|
@permissions ||= [] |
|
|
|
@permissions ||= [] |
|
|
|
@permissions += mapper.mapped_permissions |
|
|
|
@permissions += mapper.mapped_permissions |
|
|
|
|
|
|
|
@project_modules_without_permissions ||= [] |
|
|
|
|
|
|
|
@project_modules_without_permissions += mapper.project_modules_without_permissions |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def permissions |
|
|
|
def permissions |
|
|
@ -50,7 +52,9 @@ module Redmine |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def available_project_modules |
|
|
|
def available_project_modules |
|
|
|
@available_project_modules ||= @permissions.collect(&:project_module).uniq.compact |
|
|
|
@available_project_modules ||= ( |
|
|
|
|
|
|
|
@permissions.collect(&:project_module) + @project_modules_without_permissions |
|
|
|
|
|
|
|
).uniq.compact |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def modules_permissions(modules) |
|
|
|
def modules_permissions(modules) |
|
|
@ -61,6 +65,7 @@ module Redmine |
|
|
|
class Mapper |
|
|
|
class Mapper |
|
|
|
def initialize |
|
|
|
def initialize |
|
|
|
@project_module = nil |
|
|
|
@project_module = nil |
|
|
|
|
|
|
|
@project_modules_without_permissions = [] |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def permission(name, hash, options={}) |
|
|
|
def permission(name, hash, options={}) |
|
|
@ -70,14 +75,22 @@ module Redmine |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def project_module(name, options={}) |
|
|
|
def project_module(name, options={}) |
|
|
|
@project_module = name |
|
|
|
if block_given? |
|
|
|
yield self |
|
|
|
@project_module = name |
|
|
|
@project_module = nil |
|
|
|
yield self |
|
|
|
|
|
|
|
@project_module = nil |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
@project_modules_without_permissions << name |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
def mapped_permissions |
|
|
|
def mapped_permissions |
|
|
|
@permissions |
|
|
|
@permissions |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def project_modules_without_permissions |
|
|
|
|
|
|
|
@project_modules_without_permissions |
|
|
|
|
|
|
|
end |
|
|
|
end |
|
|
|
end |
|
|
|
|
|
|
|
|
|
|
|
class Permission |
|
|
|
class Permission |
|
|
|