Archive

January, 2012Archive for

Redmine 1.4 & Block user show(show only for admin)

January 27, 2012 admin No comments

vi app/controllers/users_controller.rb

    @events_by_day = events.group_by(&:event_date)

    if !User.current.admin?
        render_404
        return
    end

 

rake tmp:cache:clear
rake tmp:sessions:clear
touch tmp/restart.txt

Categories: Redmine Tags:

Redmine 1.4 & Hide list of members(author, assignee) in reports (show only for admin)

January 26, 2012 admin No comments

vi app/views/reports/issue_report.html.erb

<%= render :partial => 'simple', :locals => { :data => @issues_by_priority, :field_name => "priority_id", :rows => @priorities } %>
<br />
<% if User.current.admin? %>
<h3><%=l(:field_assigned_to)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'assigned_to' %></h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_assigned_to, :field_name => "assigned_to_id", :rows => @assignees } %>
<h3><%=l(:field_author)%>&nbsp;&nbsp;<%= link_to image_tag('zoom_in.png'), :action => 'issue_report_details', :detail => 'author' %></h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_author, :field_name => "author_id", :rows => @authors } %>
<% end %>

 

vi app/controllers/reports_controller.rb

    when "assigned_to"
      if User.current.admin?
        @field = "assigned_to_id"
        @rows = (Setting.issue_group_assignment? ? @project.principals : @project.users).sort
        @data = Issue.by_assigned_to(@project)
        @report_title = l(:field_assigned_to)
      end
    when "author"
      if User.current.admin?
        @field = "author_id"
        @rows = @project.users.sort
        @data = Issue.by_author(@project)
        @report_title = l(:field_author)
      endif
...

 

vi app/models/query.rb

    users = principals.select {|p| p.is_a?(User)}

    if User.current.admin?
      assigned_to_values = []
      assigned_to_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
      assigned_to_values += (Setting.issue_group_assignment? ? principals : users).collect{|s| [s.name, s.id.to_s] }
      @available_filters["assigned_to_id"] = { :type => :list_optional, :o rder => 4, :values => assigned_to_values } unless assigned_to_values.empty?

      author_values = []
      author_values << ["<< #{l(:label_me)} >>", "me"] if User.current.logged?
      author_values += users.collect{|s| [s.name, s.id.to_s] }
      @available_filters["author_id"] = { :type => :list, :o rder => 5, :values => author_values } unless author_values.empty?

      group_values = Group.all.collect {|g| [g.name, g.id.to_s] }
      @available_filters["member_of_group"] = { :type => :list_optional, :o rder => 6, :values => group_values } unless group_values.empty?

      role_values = Role.givable.collect {|r| [r.name, r.id.to_s] }
      @available_filters["assigned_to_role"] = { :type => :list_optional, :o rder => 7, :values => role_values } unless role_values.empty?

      if User.current.logged?
        @available_filters["watcher_id"] = { :type => :list, :o rder => 15, :values => [["<< #{l(:label_me)} >>", "me"]] }
      end
    end
...

 

rake tmp:cache:clear
rake tmp:sessions:clear
touch tmp/restart.txt

Categories: Redmine Tags:

Redmine 1.4 & Fields permissions (Hide Assigned to & due date & estimated time) in issue

January 24, 2012 admin 2 comments
rpm -Uvh http://repo.webtatic.com/yum/centos/5/latest.rpm
yum install --enablerepo=webtatic git-core

 

cd vendor/plugins/
git clone git://github.com/resilva/Redmine-Fields-permissions.git
cd ..
cd ..
rake db:migrate_plugins RAILS_ENV=production
rake tmp:cache:clear
rake tmp:sessions:clear
touch tmp/restart.txt

 

ActionView::TemplateError (uninitialized constant ActionView::Base::CompiledTemplates::TabularFormBuilder) on line #1 of vendor/plugins/Redmine-Fields-permissions/app/views/issues/_attributes.rhtml:

cd lib
wget http://svn.ohwr.org/ohr-support/trunk/lib/tabular_form_builder.rb
rake tmp:cache:clear
rake tmp:sessions:clear
touch tmp/restart.txt

 

Categories: Redmine Tags:

Redmine 1.4 & Hide list of members in project overview (show only for admin)

January 24, 2012 admin No comments

vi app/views/projects/_members_box.html.erb

<% if @users_by_role.any? %>

 
to

<% if User.current.admin? %>

 

rake tmp:cache:clear
rake tmp:sessions:clear
touch tmp/restart.txt

Categories: Redmine Tags: