Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
0736f348
Commit
0736f348
authored
Jul 31, 2015
by
Douwe Maan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use before_actions
parent
d953f692
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
app/controllers/groups/application_controller.rb
app/controllers/groups/application_controller.rb
+6
-0
app/controllers/groups/group_members_controller.rb
app/controllers/groups/group_members_controller.rb
+1
-4
No files found.
app/controllers/groups/application_controller.rb
View file @
0736f348
...
@@ -18,4 +18,10 @@ class Groups::ApplicationController < ApplicationController
...
@@ -18,4 +18,10 @@ class Groups::ApplicationController < ApplicationController
return
render_404
return
render_404
end
end
end
end
def
authorize_admin_group_member!
unless
can?
(
current_user
,
:admin_group_member
,
group
)
return
render_403
end
end
end
end
app/controllers/groups/group_members_controller.rb
View file @
0736f348
...
@@ -5,6 +5,7 @@ class Groups::GroupMembersController < Groups::ApplicationController
...
@@ -5,6 +5,7 @@ class Groups::GroupMembersController < Groups::ApplicationController
# Authorize
# Authorize
before_action
:authorize_read_group!
before_action
:authorize_read_group!
before_action
:authorize_admin_group!
,
except:
[
:index
,
:leave
]
before_action
:authorize_admin_group!
,
except:
[
:index
,
:leave
]
before_action
:authorize_admin_group_member!
,
only:
[
:create
,
:resend_invite
]
def
index
def
index
@project
=
@group
.
projects
.
find
(
params
[
:project_id
])
if
params
[
:project_id
]
@project
=
@group
.
projects
.
find
(
params
[
:project_id
])
if
params
[
:project_id
]
...
@@ -21,8 +22,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
...
@@ -21,8 +22,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
end
def
create
def
create
return
render_403
unless
can?
(
current_user
,
:admin_group_member
,
@group
)
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
],
current_user
)
@group
.
add_users
(
params
[
:user_ids
].
split
(
','
),
params
[
:access_level
],
current_user
)
redirect_to
group_group_members_path
(
@group
),
notice:
'Users were successfully added.'
redirect_to
group_group_members_path
(
@group
),
notice:
'Users were successfully added.'
...
@@ -51,8 +50,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
...
@@ -51,8 +50,6 @@ class Groups::GroupMembersController < Groups::ApplicationController
end
end
def
resend_invite
def
resend_invite
return
render_403
unless
can?
(
current_user
,
:admin_group_member
,
@group
)
redirect_path
=
group_group_members_path
(
@group
)
redirect_path
=
group_group_members_path
(
@group
)
@group_member
=
@group
.
group_members
.
find
(
params
[
:id
])
@group_member
=
@group
.
group_members
.
find
(
params
[
:id
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment