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
This commit is contained in:
1 parent
8da5bad295
commit
603e11d7a5
93 files changed
+1120
-1235
No files matched your search
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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|
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -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
|
||||
Reference in new issue
Block a user