Commit e382c8df authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

team member and hook strong params

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent f86afb73
...@@ -12,7 +12,7 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -12,7 +12,7 @@ class Projects::HooksController < Projects::ApplicationController
end end
def create def create
@hook = @project.hooks.new(params[:hook]) @hook = @project.hooks.new(hook_params)
@hook.save @hook.save
if @hook.valid? if @hook.valid?
...@@ -40,4 +40,8 @@ class Projects::HooksController < Projects::ApplicationController ...@@ -40,4 +40,8 @@ class Projects::HooksController < Projects::ApplicationController
def hook def hook
@hook ||= @project.hooks.find(params[:id]) @hook ||= @project.hooks.find(params[:id])
end end
def hook_params
params.require(:hook).permit(:url)
end
end end
...@@ -27,7 +27,7 @@ class Projects::TeamMembersController < Projects::ApplicationController ...@@ -27,7 +27,7 @@ class Projects::TeamMembersController < Projects::ApplicationController
def update def update
@user_project_relation = project.users_projects.find_by(user_id: member) @user_project_relation = project.users_projects.find_by(user_id: member)
@user_project_relation.update_attributes(params[:team_member]) @user_project_relation.update_attributes(member_params)
unless @user_project_relation.valid? unless @user_project_relation.valid?
flash[:alert] = "User should have at least one role" flash[:alert] = "User should have at least one role"
...@@ -67,4 +67,8 @@ class Projects::TeamMembersController < Projects::ApplicationController ...@@ -67,4 +67,8 @@ class Projects::TeamMembersController < Projects::ApplicationController
def member def member
@member ||= User.find_by(username: params[:id]) @member ||= User.find_by(username: params[:id])
end end
def member_params
params.require(:team_member).permit(:user_id, :project_access)
end
end end
...@@ -16,8 +16,6 @@ class UsersProject < ActiveRecord::Base ...@@ -16,8 +16,6 @@ class UsersProject < ActiveRecord::Base
include Notifiable include Notifiable
include Gitlab::Access include Gitlab::Access
#attr_accessible :user, :user_id, :project_access
belongs_to :user belongs_to :user
belongs_to :project belongs_to :project
......
...@@ -22,8 +22,6 @@ class WebHook < ActiveRecord::Base ...@@ -22,8 +22,6 @@ class WebHook < ActiveRecord::Base
default_value_for :issues_events, false default_value_for :issues_events, false
default_value_for :merge_requests_events, false default_value_for :merge_requests_events, false
#attr_accessible :url
# HTTParty timeout # HTTParty timeout
default_timeout 10 default_timeout 10
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment