summaryrefslogtreecommitdiffstats
path: root/db
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2023-01-12 02:59:54 +0000
committerGo MAEDA <maeda@farend.jp>2023-01-12 02:59:54 +0000
commiteb8916bc87bda341844162fa13a97489eb7bff40 (patch)
treedb9416ded0a9645c7c818b422db4e79497abb0e5 /db
parent29ec3009452c0737a8317fbb816e8b465a01d984 (diff)
downloadredmine-eb8916bc87bda341844162fa13a97489eb7bff40.tar.gz
redmine-eb8916bc87bda341844162fa13a97489eb7bff40.zip
Introduce permission to set a project public (#38048).
Patch by Felix Schäfer. git-svn-id: https://svn.redmine.org/redmine/trunk@22038 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20221214173537_add_select_project_publicity_permission.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/db/migrate/20221214173537_add_select_project_publicity_permission.rb b/db/migrate/20221214173537_add_select_project_publicity_permission.rb
new file mode 100644
index 000000000..9b3db0cdc
--- /dev/null
+++ b/db/migrate/20221214173537_add_select_project_publicity_permission.rb
@@ -0,0 +1,15 @@
+class AddSelectProjectPublicityPermission < ActiveRecord::Migration[5.2]
+ def up
+ Role.find_each do |r|
+ r.add_permission!(:select_project_publicity) if r.permissions.include?(:edit_project)
+ end
+ end
+
+ def down
+ Role.find_each do |r|
+ r.remove_permission!(:select_project_publicity)
+ end
+ end
+
+ def run_in_request?; true end
+end