控制层增加退出项目的限制
This commit is contained in:
parent
57835abb37
commit
27ad49282c
|
@ -898,7 +898,7 @@ class ProjectsController < ApplicationController
|
||||||
@project = Project.find params[:id]
|
@project = Project.find params[:id]
|
||||||
if User.current.login?
|
if User.current.login?
|
||||||
members = Member.where(:user_id => User.current.id, :project_id=>params[:id]).first
|
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
|
members.destroy
|
||||||
end
|
end
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
<div style="margin-left: 20px;">
|
<div style="margin-left: 20px;">
|
||||||
<% if ((User.current.member_of? @project) &&
|
<% if ((User.current.member_of? @project) &&
|
||||||
User.current.login? &&
|
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) %>
|
<%= exit_project_link(@project) %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
Loading…
Reference in New Issue