控制层增加退出项目的限制

This commit is contained in:
sw 2014-09-27 16:43:07 +08:00
parent 57835abb37
commit 27ad49282c
2 changed files with 2 additions and 2 deletions

View File

@ -898,7 +898,7 @@ class ProjectsController < ApplicationController
@project = Project.find params[:id]
if User.current.login?
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
if members != nil
if members != nil && members.roles.first.to_s != "Manager"
members.destroy
end
respond_to do |format|

View File

@ -16,7 +16,7 @@
<div style="margin-left: 20px;">
<% if ((User.current.member_of? @project) &&
User.current.login? &&
@project.members.where("user_id = #{User.current.id}").first.roles.first.to_s != "Manager") %>
Member.where(:user_id => User.current.id, :project_id=>@project.id).first.roles.first.to_s != "Manager") %>
<%= exit_project_link(@project) %>
<% end %>
</div>