Merge branch 'refactoring_group_controllers' into 'master'
Group controllers refactoring Usefulness of this refactoring is not so obvious on CE codebase. But It will allow us to remove huge amount of code on the EE side. See merge request !1684
This commit is contained in:
commit
d377e94b35
3 changed files with 12 additions and 14 deletions
10
app/controllers/groups/application_controller.rb
Normal file
10
app/controllers/groups/application_controller.rb
Normal file
|
@ -0,0 +1,10 @@
|
|||
class Groups::ApplicationController < ApplicationController
|
||||
|
||||
private
|
||||
|
||||
def authorize_admin_group!
|
||||
unless can?(current_user, :manage_group, group)
|
||||
return render_404
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,4 +1,4 @@
|
|||
class Groups::GroupMembersController < ApplicationController
|
||||
class Groups::GroupMembersController < Groups::ApplicationController
|
||||
before_filter :group
|
||||
|
||||
# Authorize
|
||||
|
@ -37,12 +37,6 @@ class Groups::GroupMembersController < ApplicationController
|
|||
@group ||= Group.find_by(path: params[:group_id])
|
||||
end
|
||||
|
||||
def authorize_admin_group!
|
||||
unless can?(current_user, :manage_group, group)
|
||||
return render_404
|
||||
end
|
||||
end
|
||||
|
||||
def member_params
|
||||
params.require(:group_member).permit(:access_level, :user_id)
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
class GroupsController < ApplicationController
|
||||
class GroupsController < Groups::ApplicationController
|
||||
skip_before_filter :authenticate_user!, only: [:show, :issues, :members, :merge_requests]
|
||||
respond_to :html
|
||||
before_filter :group, except: [:new, :create]
|
||||
|
@ -132,12 +132,6 @@ class GroupsController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def authorize_admin_group!
|
||||
unless can?(current_user, :manage_group, group)
|
||||
return render_404
|
||||
end
|
||||
end
|
||||
|
||||
def set_title
|
||||
@title = 'New Group'
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue