if args.first && args.first.is_a?(String) && !/^\d*$/.match?(args.first)
project = find_by_identifier(*args)
raise ActiveRecord::RecordNotFound, "Couldn't find Project with identifier=#{args.first}" if project.nil?
+
project
else
super
exists?
return false
end
+
Project.transaction do
archive!
end
# by the current user
def allowed_parents(user=User.current)
return @allowed_parents if @allowed_parents
+
@allowed_parents = Project.allowed_to(user, :add_subprojects).to_a
@allowed_parents = @allowed_parents - self_and_descendants
if user.allowed_to?(:add_project, nil, :global => true) || (!new_record? && parent.nil?)
# No write action allowed on closed projects
return false
end
+
# No action allowed on disabled modules
if action.is_a? Hash
allowed_actions.include? "#{action[:controller]}/#{action[:action]}"
if attrs.respond_to?(:to_unsafe_hash)
attrs = attrs.to_unsafe_hash
end
-
return unless attrs.is_a?(Hash)
+
attrs = attrs.deep_dup
@unallowed_parent_id = nil
project.wiki.pages.each do |page|
# Skip pages without content
next if page.content.nil?
+
new_wiki_content = WikiContent.new(page.content.attributes.dup.except("id", "page_id", "updated_on"))
new_wiki_page = WikiPage.new(page.attributes.dup.except("id", "wiki_id", "created_on", "parent_id"))
new_wiki_page.content = new_wiki_content
# 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