summaryrefslogtreecommitdiffstats
path: root/db/migrate
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-29 16:52:35 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-08-29 16:52:35 +0000
commit603e11d7a5aa62f923e7b013cac6c66462131232 (patch)
treefbbb204d2b92b5a87b787d56fe3f9c62cc3f259b /db/migrate
parent8da5bad29516be6cbe1bc52e78837ac1ec292026 (diff)
downloadredmine-603e11d7a5aa62f923e7b013cac6c66462131232.tar.gz
redmine-603e11d7a5aa62f923e7b013cac6c66462131232.zip
Merged 0.6 branch into trunk.
Permissions management was rewritten. Some permissions can now be specifically defined for non member and anonymous users. This migration: * is irreversible (please, don't forget to *backup* your database before upgrading) * resets role's permissions (go to "Admin -> Roles & Permissions" to set them after upgrading) git-svn-id: http://redmine.rubyforge.org/svn/trunk@674 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/001_setup.rb4
-rw-r--r--db/migrate/002_issue_move.rb3
-rw-r--r--db/migrate/003_issue_add_note.rb3
-rw-r--r--db/migrate/004_export_pdf.rb3
-rw-r--r--db/migrate/006_calendar_and_activity.rb3
-rw-r--r--db/migrate/007_create_journals.rb2
-rw-r--r--db/migrate/012_add_comments_permissions.rb3
-rw-r--r--db/migrate/014_add_queries_permissions.rb3
-rw-r--r--db/migrate/016_add_repositories_permissions.rb3
-rw-r--r--db/migrate/018_set_doc_and_files_notifications.rb3
-rw-r--r--db/migrate/024_add_roadmap_permission.rb3
-rw-r--r--db/migrate/025_add_search_permission.rb3
-rw-r--r--db/migrate/030_add_projects_feeds_permissions.rb3
-rw-r--r--db/migrate/033_add_timelog_permissions.rb3
-rw-r--r--db/migrate/043_add_relations_permissions.rb3
-rw-r--r--db/migrate/047_add_boards_permissions.rb3
-rw-r--r--db/migrate/049_add_wiki_destroy_page_permission.rb3
-rw-r--r--db/migrate/050_add_wiki_attachments_permissions.rb3
-rw-r--r--db/migrate/056_add_repositories_changes_permission.rb3
-rw-r--r--db/migrate/061_add_roles_builtin.rb9
-rw-r--r--db/migrate/062_insert_builtin_roles.rb15
-rw-r--r--db/migrate/063_add_roles_permissions.rb9
-rw-r--r--db/migrate/064_drop_permissions.rb10
23 files changed, 100 insertions, 0 deletions
diff --git a/db/migrate/001_setup.rb b/db/migrate/001_setup.rb
index c61b2c37f..8b299eb1e 100644
--- a/db/migrate/001_setup.rb
+++ b/db/migrate/001_setup.rb
@@ -16,6 +16,10 @@
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
class Setup < ActiveRecord::Migration
+
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
create_table "attachments", :force => true do |t|
t.column "container_id", :integer, :default => 0, :null => false
diff --git a/db/migrate/002_issue_move.rb b/db/migrate/002_issue_move.rb
index d1acf7ee2..085593e08 100644
--- a/db/migrate/002_issue_move.rb
+++ b/db/migrate/002_issue_move.rb
@@ -1,4 +1,7 @@
class IssueMove < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "projects", :action => "move_issues", :description => "button_move", :sort => 1061, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/003_issue_add_note.rb b/db/migrate/003_issue_add_note.rb
index 9f20039b0..a2ab756ee 100644
--- a/db/migrate/003_issue_add_note.rb
+++ b/db/migrate/003_issue_add_note.rb
@@ -1,4 +1,7 @@
class IssueAddNote < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "issues", :action => "add_note", :description => "label_add_note", :sort => 1057, :mail_option => 1, :mail_enabled => 0
end
diff --git a/db/migrate/004_export_pdf.rb b/db/migrate/004_export_pdf.rb
index 66045553f..6ccd67eae 100644
--- a/db/migrate/004_export_pdf.rb
+++ b/db/migrate/004_export_pdf.rb
@@ -1,4 +1,7 @@
class ExportPdf < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "projects", :action => "export_issues_pdf", :description => "label_export_pdf", :sort => 1002, :is_public => true, :mail_option => 0, :mail_enabled => 0
Permission.create :controller => "issues", :action => "export_pdf", :description => "label_export_pdf", :sort => 1015, :is_public => true, :mail_option => 0, :mail_enabled => 0
diff --git a/db/migrate/006_calendar_and_activity.rb b/db/migrate/006_calendar_and_activity.rb
index 5d8474fc2..1cdc91d8e 100644
--- a/db/migrate/006_calendar_and_activity.rb
+++ b/db/migrate/006_calendar_and_activity.rb
@@ -1,4 +1,7 @@
class CalendarAndActivity < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "projects", :action => "activity", :description => "label_activity", :sort => 160, :is_public => true, :mail_option => 0, :mail_enabled => 0
Permission.create :controller => "projects", :action => "calendar", :description => "label_calendar", :sort => 165, :is_public => true, :mail_option => 0, :mail_enabled => 0
diff --git a/db/migrate/007_create_journals.rb b/db/migrate/007_create_journals.rb
index 6170b5bd3..b00347839 100644
--- a/db/migrate/007_create_journals.rb
+++ b/db/migrate/007_create_journals.rb
@@ -2,6 +2,8 @@ class CreateJournals < ActiveRecord::Migration
# model removed, but needed for data migration
class IssueHistory < ActiveRecord::Base; belongs_to :issue; end
+ # model removed
+ class Permission < ActiveRecord::Base; end
def self.up
create_table :journals, :force => true do |t|
diff --git a/db/migrate/012_add_comments_permissions.rb b/db/migrate/012_add_comments_permissions.rb
index 37f075082..2bbf87b02 100644
--- a/db/migrate/012_add_comments_permissions.rb
+++ b/db/migrate/012_add_comments_permissions.rb
@@ -1,4 +1,7 @@
class AddCommentsPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "news", :action => "add_comment", :description => "label_comment_add", :sort => 1130, :is_public => false, :mail_option => 0, :mail_enabled => 0
Permission.create :controller => "news", :action => "destroy_comment", :description => "label_comment_delete", :sort => 1133, :is_public => false, :mail_option => 0, :mail_enabled => 0
diff --git a/db/migrate/014_add_queries_permissions.rb b/db/migrate/014_add_queries_permissions.rb
index 27d674650..34eba1e26 100644
--- a/db/migrate/014_add_queries_permissions.rb
+++ b/db/migrate/014_add_queries_permissions.rb
@@ -1,4 +1,7 @@
class AddQueriesPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "projects", :action => "add_query", :description => "button_create", :sort => 600, :is_public => false, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/016_add_repositories_permissions.rb b/db/migrate/016_add_repositories_permissions.rb
index 992f8dccd..341707639 100644
--- a/db/migrate/016_add_repositories_permissions.rb
+++ b/db/migrate/016_add_repositories_permissions.rb
@@ -1,4 +1,7 @@
class AddRepositoriesPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "repositories", :action => "show", :description => "button_view", :sort => 1450, :is_public => true
Permission.create :controller => "repositories", :action => "browse", :description => "label_browse", :sort => 1460, :is_public => true
diff --git a/db/migrate/018_set_doc_and_files_notifications.rb b/db/migrate/018_set_doc_and_files_notifications.rb
index adbdd3b88..8c1d054c1 100644
--- a/db/migrate/018_set_doc_and_files_notifications.rb
+++ b/db/migrate/018_set_doc_and_files_notifications.rb
@@ -1,4 +1,7 @@
class SetDocAndFilesNotifications < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.find_by_controller_and_action("projects", "add_file").update_attribute(:mail_option, true)
Permission.find_by_controller_and_action("projects", "add_document").update_attribute(:mail_option, true)
diff --git a/db/migrate/024_add_roadmap_permission.rb b/db/migrate/024_add_roadmap_permission.rb
index 5b9f3a562..5c37beac1 100644
--- a/db/migrate/024_add_roadmap_permission.rb
+++ b/db/migrate/024_add_roadmap_permission.rb
@@ -1,4 +1,7 @@
class AddRoadmapPermission < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "projects", :action => "roadmap", :description => "label_roadmap", :sort => 107, :is_public => true, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/025_add_search_permission.rb b/db/migrate/025_add_search_permission.rb
index 408716eb6..a942b01b3 100644
--- a/db/migrate/025_add_search_permission.rb
+++ b/db/migrate/025_add_search_permission.rb
@@ -1,4 +1,7 @@
class AddSearchPermission < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "projects", :action => "search", :description => "label_search", :sort => 130, :is_public => true, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/030_add_projects_feeds_permissions.rb b/db/migrate/030_add_projects_feeds_permissions.rb
index 63131001e..7f97035bf 100644
--- a/db/migrate/030_add_projects_feeds_permissions.rb
+++ b/db/migrate/030_add_projects_feeds_permissions.rb
@@ -1,4 +1,7 @@
class AddProjectsFeedsPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "projects", :action => "feeds", :description => "label_feed_plural", :sort => 132, :is_public => true, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/033_add_timelog_permissions.rb b/db/migrate/033_add_timelog_permissions.rb
index 3b5b81ed6..ab9c809e6 100644
--- a/db/migrate/033_add_timelog_permissions.rb
+++ b/db/migrate/033_add_timelog_permissions.rb
@@ -1,4 +1,7 @@
class AddTimelogPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "timelog", :action => "edit", :description => "button_log_time", :sort => 1520, :is_public => false, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/043_add_relations_permissions.rb b/db/migrate/043_add_relations_permissions.rb
index 3f1da8f27..32d464a58 100644
--- a/db/migrate/043_add_relations_permissions.rb
+++ b/db/migrate/043_add_relations_permissions.rb
@@ -1,4 +1,7 @@
class AddRelationsPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "issue_relations", :action => "new", :description => "label_relation_new", :sort => 1080, :is_public => false, :mail_option => 0, :mail_enabled => 0
Permission.create :controller => "issue_relations", :action => "destroy", :description => "label_relation_delete", :sort => 1085, :is_public => false, :mail_option => 0, :mail_enabled => 0
diff --git a/db/migrate/047_add_boards_permissions.rb b/db/migrate/047_add_boards_permissions.rb
index cafdc1eac..5b1f6f779 100644
--- a/db/migrate/047_add_boards_permissions.rb
+++ b/db/migrate/047_add_boards_permissions.rb
@@ -1,4 +1,7 @@
class AddBoardsPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => "boards", :action => "new", :description => "button_add", :sort => 2000, :is_public => false, :mail_option => 0, :mail_enabled => 0
Permission.create :controller => "boards", :action => "edit", :description => "button_edit", :sort => 2005, :is_public => false, :mail_option => 0, :mail_enabled => 0
diff --git a/db/migrate/049_add_wiki_destroy_page_permission.rb b/db/migrate/049_add_wiki_destroy_page_permission.rb
index c68370f22..c82152388 100644
--- a/db/migrate/049_add_wiki_destroy_page_permission.rb
+++ b/db/migrate/049_add_wiki_destroy_page_permission.rb
@@ -1,4 +1,7 @@
class AddWikiDestroyPagePermission < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => 'wiki', :action => 'destroy', :description => 'button_delete', :sort => 1740, :is_public => false, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/050_add_wiki_attachments_permissions.rb b/db/migrate/050_add_wiki_attachments_permissions.rb
index 6c81273a1..c0697be9c 100644
--- a/db/migrate/050_add_wiki_attachments_permissions.rb
+++ b/db/migrate/050_add_wiki_attachments_permissions.rb
@@ -1,4 +1,7 @@
class AddWikiAttachmentsPermissions < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => 'wiki', :action => 'add_attachment', :description => 'label_attachment_new', :sort => 1750, :is_public => false, :mail_option => 0, :mail_enabled => 0
Permission.create :controller => 'wiki', :action => 'destroy_attachment', :description => 'label_attachment_delete', :sort => 1755, :is_public => false, :mail_option => 0, :mail_enabled => 0
diff --git a/db/migrate/056_add_repositories_changes_permission.rb b/db/migrate/056_add_repositories_changes_permission.rb
index e93514900..0d9b13b59 100644
--- a/db/migrate/056_add_repositories_changes_permission.rb
+++ b/db/migrate/056_add_repositories_changes_permission.rb
@@ -1,4 +1,7 @@
class AddRepositoriesChangesPermission < ActiveRecord::Migration
+ # model removed
+ class Permission < ActiveRecord::Base; end
+
def self.up
Permission.create :controller => 'repositories', :action => 'changes', :description => 'label_change_plural', :sort => 1475, :is_public => true, :mail_option => 0, :mail_enabled => 0
end
diff --git a/db/migrate/061_add_roles_builtin.rb b/db/migrate/061_add_roles_builtin.rb
new file mode 100644
index 000000000..a8d6fe9e6
--- /dev/null
+++ b/db/migrate/061_add_roles_builtin.rb
@@ -0,0 +1,9 @@
+class AddRolesBuiltin < ActiveRecord::Migration
+ def self.up
+ add_column :roles, :builtin, :integer, :default => 0, :null => false
+ end
+
+ def self.down
+ remove_column :roles, :builtin
+ end
+end
diff --git a/db/migrate/062_insert_builtin_roles.rb b/db/migrate/062_insert_builtin_roles.rb
new file mode 100644
index 000000000..27c7475c3
--- /dev/null
+++ b/db/migrate/062_insert_builtin_roles.rb
@@ -0,0 +1,15 @@
+class InsertBuiltinRoles < ActiveRecord::Migration
+ def self.up
+ nonmember = Role.new(:name => 'Non member', :position => 0)
+ nonmember.builtin = Role::BUILTIN_NON_MEMBER
+ nonmember.save
+
+ anonymous = Role.new(:name => 'Anonymous', :position => 0)
+ anonymous.builtin = Role::BUILTIN_ANONYMOUS
+ anonymous.save
+ end
+
+ def self.down
+ Role.destroy_all 'builtin <> 0'
+ end
+end
diff --git a/db/migrate/063_add_roles_permissions.rb b/db/migrate/063_add_roles_permissions.rb
new file mode 100644
index 000000000..107a3af0a
--- /dev/null
+++ b/db/migrate/063_add_roles_permissions.rb
@@ -0,0 +1,9 @@
+class AddRolesPermissions < ActiveRecord::Migration
+ def self.up
+ add_column :roles, :permissions, :text
+ end
+
+ def self.down
+ remove_column :roles, :permissions
+ end
+end
diff --git a/db/migrate/064_drop_permissions.rb b/db/migrate/064_drop_permissions.rb
new file mode 100644
index 000000000..f4ca470bf
--- /dev/null
+++ b/db/migrate/064_drop_permissions.rb
@@ -0,0 +1,10 @@
+class DropPermissions < ActiveRecord::Migration
+ def self.up
+ drop_table :permissions
+ drop_table :permissions_roles
+ end
+
+ def self.down
+ raise IrreversibleMigration
+ end
+end