Fixes #5 : Projects and subsequent DMSF children are now not permitted access to where the project does not have DMSF module enabled.
This commit is contained in:
parent
c639e25f10
commit
6f7a4f2e4a
@ -48,8 +48,9 @@ module RedmineDmsf
|
|||||||
# Does the object exist?
|
# Does the object exist?
|
||||||
# If it is either a folder or a file, then it exists
|
# If it is either a folder or a file, then it exists
|
||||||
# - 2012-06-15: Only if you're allowed to browse the project
|
# - 2012-06-15: Only if you're allowed to browse the project
|
||||||
|
# - 2012-06-18: Issue #5, ensure item is only listed if project is enabled for dmsf
|
||||||
def exist?
|
def exist?
|
||||||
return false if project.nil? || !(folder? || file?)
|
return false if project.nil? || project.module_enabled?('dmsf').nil? || !(folder? || file?)
|
||||||
User.current.admin? ? true : User.current.allowed_to?(:view_dmsf_folders, project)
|
User.current.admin? ? true : User.current.allowed_to?(:view_dmsf_folders, project)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@ -38,8 +38,10 @@ module RedmineDmsf
|
|||||||
@children
|
@children
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# - 2012-06-18: Issue #5, ensure item is only listed if project is enabled for dmsf
|
||||||
def exist?
|
def exist?
|
||||||
return false if (project.nil? || User.current.anonymous?)
|
return false if (project.nil? || User.current.anonymous?)
|
||||||
|
return false if (project.module_enabled?('dmsf').nil?) #See Issue #5
|
||||||
return true if User.current.admin?
|
return true if User.current.admin?
|
||||||
User.current.allowed_to?(:view_dmsf_folders, project)
|
User.current.allowed_to?(:view_dmsf_folders, project)
|
||||||
end
|
end
|
||||||
|
|||||||
17
test/fixtures/dmsf_folders.yml
vendored
17
test/fixtures/dmsf_folders.yml
vendored
@ -1,24 +1,15 @@
|
|||||||
# Read about fixtures at http://ar.rubyonrails.org/classes/Fixtures.html
|
--- !omap
|
||||||
# It is possible to use ERb template markup
|
- dmsf_folders_001:
|
||||||
one:
|
|
||||||
id: 1
|
id: 1
|
||||||
|
|
||||||
title: folder1
|
title: folder1
|
||||||
|
|
||||||
project_id: 1
|
project_id: 1
|
||||||
|
dmsf_folder_id: NULL
|
||||||
dmsf_folder_id:
|
|
||||||
|
|
||||||
user_id: 1
|
user_id: 1
|
||||||
|
|
||||||
two:
|
- dmsf_folders_002:
|
||||||
id: 2
|
id: 2
|
||||||
|
|
||||||
title: folder2
|
title: folder2
|
||||||
|
|
||||||
project_id: 1
|
project_id: 1
|
||||||
|
|
||||||
dmsf_folder_id: 1
|
dmsf_folder_id: 1
|
||||||
|
|
||||||
user_id: 1
|
user_id: 1
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user