verify :method => :post, :only => [:grant_users, :grant_groups ], :redirect_to => { :action => 'index' }
def index
- @project=Project.by_key(params[:resource])
+ @project=Project.by_key(params[:id])
access_denied unless is_admin?(@project)
end
def edit_users
- @project=Project.by_key(params[:resource])
+ @project=Project.by_key(params[:id])
access_denied unless is_admin?(@project)
@role = params[:role]
end
def edit_groups
- @project=Project.by_key(params[:resource])
+ @project=Project.by_key(params[:id])
access_denied unless is_admin?(@project)
@role = params[:role]
end
def grant_users
- project=Project.by_key(params[:resource])
+ project=Project.by_key(params[:id])
access_denied unless is_admin?(project)
UserRole.grant_users(params[:users], params[:role], project.id)
- redirect_to(:action => 'index', :resource => project.id)
+ redirect_to(:action => 'index', :id => project.id)
end
def grant_groups
- project=Project.by_key(params[:resource])
+ project=Project.by_key(params[:id])
access_denied unless is_admin?(project)
GroupRole.grant_groups(params[:groups], params[:role], project.id)
- redirect_to(:action => 'index', :resource => project.id)
+ redirect_to(:action => 'index', :id => project.id)
end
end
granted_groups=groups(@role, @project.id)
ungranted_groups=all_groups - granted_groups
%>
-<div class="subtitle">» <a href="<%= url_for :action => 'index', :resource => @project.id -%>">Back</a></div>
+<div class="subtitle">» <a href="<%= url_for :action => 'index', :id => @project.id -%>">Back</a></div>
<h1>Role Membership Of <%= h(@project.name) %></h1>
<br/>
<div>
<form action="<%= url_for :action => 'grant_groups' -%>" method="post">
- <input name="resource" value="<%= @project.id -%>" type="hidden"/>
+ <input name="id" value="<%= @project.id -%>" type="hidden"/>
<input name="role" value="<%= @role -%>" type="hidden"/>
<table>
<tbody>
<div style="padding: 5px 0">
<input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
- <a href="<%= url_for :action => 'index', :resource => @project.id -%>"><%= message 'cancel' -%></a>
+ <a href="<%= url_for :action => 'index', :id => @project.id -%>"><%= message 'cancel' -%></a>
</div>
</td>
</tr>
<%
- granted_users=users(@role, params[:resource])
+ granted_users=users(@role, params[:id])
ungranted_users=all_users - granted_users
%>
-<div class="subtitle">» <a href="<%= url_for :action => 'index', :resource => @project.id -%>">Back</a></div>
+<div class="subtitle">» <a href="<%= url_for :action => 'index', :id => @project.id -%>">Back</a></div>
<h1>Role Membership Of <%= h(@project.name) %></h1>
<br/>
<div id="main_content">
<form action="<%= url_for :action => 'grant_users' -%>" method="post">
- <input name="resource" value="<%= params[:resource] -%>" type="hidden"/>
+ <input name="id" value="<%= params[:id] -%>" type="hidden"/>
<input name="role" value="<%= @role -%>" type="hidden"/>
<input name="redirect" value="<%= params[:redirect] -%>" type="hidden"/>
<table>
<div style="padding: 5px 0;">
<input id="save" value="Save" onclick="SelectBox.select_all('to');submit();return false;" type="submit">
- <a href="<%= url_for :action => 'index', :resource => @project.id -%>"><%= message 'cancel' -%></a>
+ <a href="<%= url_for :action => 'index', :id => @project.id -%>"><%= message 'cancel' -%></a>
</div>
</td>
</tr>
<tr class="even" >
<td valign="top"><b>Administrators</b><br/><span class="small gray">Ability to perform administration functions for a project by accessing its settings.</span></td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= users('admin', params[:resource]).map(&:name).join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_users', :resource => @project.id, :role => 'admin'}, :class => 'link-action' %>)
+ <span><%= users('admin', params[:id]).map(&:name).join(', ') %></span>
+ (<%= link_to "select", {:action => 'edit_users', :id => @project.id, :role => 'admin'}, :class => 'link-action' %>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= groups('admin', params[:resource]).map{|g| group_name(g)}.join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_groups', :resource => @project.id, :role => 'admin'}, :class => 'link-action' %>)
+ <span><%= groups('admin', params[:id]).map{|g| group_name(g)}.join(', ') %></span>
+ (<%= link_to "select", {:action => 'edit_groups', :id => @project.id, :role => 'admin'}, :class => 'link-action' %>)
</td>
</tr>
<tr class="odd">
<td valign="top"><b>Users</b><br/><span class="small gray">Ability to navigate through every service of a project, except viewing source code and settings.</span></td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= users('user', params[:resource]).map(&:name).join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_users', :resource => @project.id, :role => 'user'}, :class => 'link-action' %>)
+ <span><%= users('user', params[:id]).map(&:name).join(', ') %></span>
+ (<%= link_to "select", {:action => 'edit_users', :id => @project.id, :role => 'user'}, :class => 'link-action' %>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= groups('user', params[:resource]).map{|g| group_name(g)}.join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_groups', :resource => @project.id, :role => 'user'}, :class => 'link-action' %>)
+ <span><%= groups('user', params[:id]).map{|g| group_name(g)}.join(', ') %></span>
+ (<%= link_to "select", {:action => 'edit_groups', :id => @project.id, :role => 'user'}, :class => 'link-action' %>)
</td>
</tr>
<tr class="even" >
<td valign="top"><b>Code viewers</b><br/><span class="small gray">Ability to view source code of a project.</span></td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= users('codeviewer', params[:resource]).map(&:name).join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_users', :resource => @project.id, :role => 'codeviewer'}, :class => 'link-action' %>)
+ <span><%= users('codeviewer', params[:id]).map(&:name).join(', ') %></span>
+ (<%= link_to "select", {:action => 'edit_users', :id => @project.id, :role => 'codeviewer'}, :class => 'link-action' %>)
</td>
<td valign="top" style="word-break:break-all;width:35%;">
- <span><%= groups('codeviewer', params[:resource]).map{|g| group_name(g)}.join(', ') %></span>
- (<%= link_to "select", {:action => 'edit_groups', :resource => @project.id, :role => 'codeviewer'}, :class => 'link-action' %>)
+ <span><%= groups('codeviewer', params[:id]).map{|g| group_name(g)}.join(', ') %></span>
+ (<%= link_to "select", {:action => 'edit_groups', :id => @project.id, :role => 'codeviewer'}, :class => 'link-action' %>)
</td>
</tr>
</tbody>