member_roles.detect {|mr| mr.inherited_from}.nil?
end
+ def include?(user)
+ if principal.is_a?(Group)
+ !user.nil? && user.groups.include?(principal)
+ else
+ self.user == user
+ end
+ end
+
def before_destroy
if user
# remove category based auto assignments for this member
errors.add :role_id, :invalid if role && !role.member?
end
+ def inherited?
+ !inherited_from.nil?
+ end
+
private
def remove_member_if_empty
# Specific overidden Activities
has_many :time_entry_activities
has_many :members, :include => [:user, :roles], :conditions => "#{User.table_name}.type='User' AND #{User.table_name}.status=#{User::STATUS_ACTIVE}"
+ has_many :memberships, :class_name => 'Member'
has_many :member_principals, :class_name => 'Member',
:include => :principal,
:conditions => "#{Principal.table_name}.type='Group' OR (#{Principal.table_name}.type='User' AND #{Principal.table_name}.status=#{User::STATUS_ACTIVE})"
# Copies members from +project+
def copy_members(project)
- project.members.each do |member|
+ project.memberships.each do |member|
new_member = Member.new
new_member.attributes = member.attributes.dup.except("id", "project_id", "created_on")
- new_member.role_ids = member.role_ids.dup
+ # only copy non inherited roles
+ # inherited roles will be added when copying the group membership
+ role_ids = member.member_roles.reject(&:inherited?).collect(&:role_id)
+ next if role_ids.empty?
+ new_member.role_ids = role_ids
new_member.project = self
self.members << new_member
end
<td class="buttons">
<%= link_to_function l(:button_edit), "$('member-#{member.id}-roles').hide(); $('member-#{member.id}-roles-form').show(); return false;", :class => 'icon icon-edit' %>
<%= link_to_remote(l(:button_delete), { :url => {:controller => 'members', :action => 'destroy', :id => member},
- :method => :post
+ :method => :post,
+ :confirm => (!User.current.admin? && member.include?(User.current) ? l(:text_own_membership_delete_confirmation) : nil)
}, :title => l(:button_delete),
:class => 'icon icon-del') if member.deletable? %>
</td>
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
text_wiki_page_nullify_children: "Keep child pages as root pages"
text_wiki_page_destroy_children: "Delete child pages and all their descendants"
text_wiki_page_reassign_children: "Reassign child pages to this parent page"
+ text_own_membership_delete_confirmation: "You are about to remove some or all of your permissions and may no longer be able to edit this project after that.\nAre you sure you want to continue?"
default_role_manager: Manager
default_role_developper: Developer
setting_mail_handler_body_delimiters: Truncar correos tras una de estas líneas
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
text_wiki_page_nullify_children: "Conserver les sous-pages en tant que pages racines"
text_wiki_page_destroy_children: "Supprimer les sous-pages et toutes leurs descedantes"
text_wiki_page_reassign_children: "Réaffecter les sous-pages à cette page"
+ text_own_membership_delete_confirmation: "Vous allez supprimer tout ou partie de vos permissions sur ce projet et ne serez peut-être plus autorisé à modifier ce projet.\nEtes-vous sûr de vouloir continuer ?"
default_role_manager: Manager
default_role_developper: Développeur
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
enumeration_system_activity: 系統活動
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
setting_mail_handler_body_delimiters: Truncate emails after one of these lines
permission_add_subprojects: Create subprojects
label_subproject_new: New subproject
+ text_own_membership_delete_confirmation: |-
+ You are about to remove some or all of your permissions and may no longer be able to edit this project after that.
+ Are you sure you want to continue?
--- /dev/null
+class ChangeWikiContentsTextLimit < ActiveRecord::Migration
+ def self.up
+ # Migrates MySQL databases only
+ # Postgres would raise an error (see http://dev.rubyonrails.org/ticket/3818)
+ # Not fixed in Rails 2.3.5
+ if ActiveRecord::Base.connection.adapter_name =~ /mysql/i
+ max_size = 16.megabytes
+ change_column :wiki_contents, :text, :text, :limit => max_size
+ change_column :wiki_content_versions, :data, :binary, :limit => max_size
+ end
+ end
+
+ def self.down
+ # no-op
+ end
+end
end
def self.shellout(cmd, &block)
- logger.debug "Shelling out: #{cmd}" if logger && logger.debug?
+ logger.debug "Shelling out: #{strip_credential(cmd)}" if logger && logger.debug?
if Rails.env == 'development'
# Capture stderr when running in dev environment
cmd = "#{cmd} 2>>#{RAILS_ROOT}/log/scm.stderr.log"
cal.create();
cal.refresh();
if (!params.position)
- cal.showAtElement(params.button || params.displayArea || params.inputField, params.align);
+ cal.showAtElement(params.button || params.displayArea || params.inputField);
else
cal.showAt(params.position[0], params.position[1]);
return false;
groups_users_001:
group_id: 10
user_id: 8
+groups_users_002:
+ group_id: 11
+ user_id: 8
\ No newline at end of file
role_id: 2
member_id: 7
inherited_from: 7
+member_roles_010:
+ id: 10
+ role_id: 2
+ member_id: 9
+ inherited_from:
+member_roles_011:
+ id: 11
+ role_id: 2
+ member_id: 10
+ inherited_from: 10
id: 8
user_id: 1
mail_notification: true
+members_009:
+ id: 9
+ created_on: 2006-07-19 19:35:33 +02:00
+ project_id: 2
+ user_id: 11
+ mail_notification: false
+members_010:
+ id: 10
+ created_on: 2006-07-19 19:35:33 +02:00
+ project_id: 2
+ user_id: 8
+ mail_notification: false
assert_not_equal source_relation_cross_project.id, copied_relation.id
end
- should "copy members" do
+ should "copy memberships" do
assert @project.valid?
assert @project.members.empty?
assert @project.copy(@source_project)
- assert_equal @source_project.members.size, @project.members.size
- @project.members.each do |member|
- assert member
- assert_equal @project, member.project
+ assert_equal @source_project.memberships.size, @project.memberships.size
+ @project.memberships.each do |membership|
+ assert membership
+ assert_equal @project, membership.project
end
end
assert_kind_of String, version.text
end
end
+
+ def test_large_text_should_not_be_truncated_to_64k
+ page = WikiPage.new(:wiki => @wiki, :title => "Big page")
+ page.content = WikiContent.new(:text => "a" * 500.kilobyte, :author => User.find(1))
+ assert page.save
+ page.reload
+ assert_equal 500.kilobyte, page.content.text.size
+ end
end