Dont allow to select a project you have no right to assign

This commit is contained in:
Dmitriy Zaporozhets 2013-01-24 14:10:17 +02:00
parent 11b7b93cf7
commit b4967b3703

View file

@ -9,9 +9,8 @@ class Teams::ProjectsController < Teams::ApplicationController
def new def new
user_team user_team
@avaliable_projects = Project.scoped @avaliable_projects = current_user.owned_projects.scoped
@avaliable_projects = @avaliable_projects.without_team(user_team) if user_team.projects.any? @avaliable_projects = @avaliable_projects.without_team(user_team) if user_team.projects.any?
#@projects.reject!(&:empty_repo?)
redirect_to team_projects_path(user_team), notice: "No avalible projects." unless @avaliable_projects.any? redirect_to team_projects_path(user_team), notice: "No avalible projects." unless @avaliable_projects.any?
end end