@@ -1,18 +1,19 | |||
|
1 | 1 | class ReplaceMoveIssuesPermission < ActiveRecord::Migration |
|
2 | 2 | def self.up |
|
3 | 3 | Role.all.each do |role| |
|
4 | 4 | if role.has_permission?(:edit_issues) && !role.has_permission?(:move_issues) |
|
5 | 5 | # inserts one ligne per trakcer and status |
|
6 | WorkflowPermission.connection.insert_sql( | |
|
7 | "INSERT INTO #{WorkflowPermission.table_name} (tracker_id, old_status_id, role_id, type, field_name, rule)" + | |
|
6 | rule = WorkflowPermission.connection.quote_column_name('rule') # rule is a reserved keyword in SQLServer | |
|
7 | WorkflowPermission.connection.execute( | |
|
8 | "INSERT INTO #{WorkflowPermission.table_name} (tracker_id, old_status_id, role_id, type, field_name, #{rule})" + | |
|
8 | 9 | " SELECT t.id, s.id, #{role.id}, 'WorkflowPermission', 'project_id', 'readonly'" + |
|
9 | 10 | " FROM #{Tracker.table_name} t, #{IssueStatus.table_name} s" |
|
10 | 11 | ) |
|
11 | 12 | end |
|
12 | 13 | end |
|
13 | 14 | end |
|
14 | 15 | |
|
15 | 16 | def self.down |
|
16 | 17 | raise IrreversibleMigration |
|
17 | 18 | end |
|
18 | 19 | end |
General Comments 0
You need to be logged in to leave comments.
Login now