BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
e747626f
Commit
e747626f
authored
Sep 05, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added test for updating groups permissions
parent
97a51817
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
4 deletions
+41
-4
group_links_controller.rb
app/controllers/projects/group_links_controller.rb
+1
-1
_group.html.haml
app/views/shared/members/_group.html.haml
+3
-3
group_links_spec.rb
spec/features/projects/members/group_links_spec.rb
+37
-0
No files found.
app/controllers/projects/group_links_controller.rb
View file @
e747626f
...
@@ -21,7 +21,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
...
@@ -21,7 +21,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
def
update
def
update
@group_link
=
@project
.
project_group_links
.
find
(
params
[
:id
])
@group_link
=
@project
.
project_group_links
.
find
(
params
[
:id
])
return
render_403
unless
can?
(
current_user
,
:admin_
group
,
@group_link
.
group
)
return
render_403
unless
can?
(
current_user
,
:admin_
project_member
,
@project
)
@group_link
.
update_attributes
(
group_link_params
)
@group_link
.
update_attributes
(
group_link_params
)
end
end
...
...
app/views/shared/members/_group.html.haml
View file @
e747626f
...
@@ -13,11 +13,11 @@
...
@@ -13,11 +13,11 @@
Expires in
#{
distance_of_time_in_words_to_now
(
group_link
.
expires_at
)
}
Expires in
#{
distance_of_time_in_words_to_now
(
group_link
.
expires_at
)
}
.controls.member-controls
.controls.member-controls
=
form_tag
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
method: :put
,
remote:
true
,
class:
'form-horizontal js-edit-member-form'
do
=
form_tag
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
method: :put
,
remote:
true
,
class:
'form-horizontal js-edit-member-form'
do
=
select_tag
'group_link[group_access]'
,
options_for_select
(
ProjectGroupLink
.
access_options
,
group_link
.
group_access
),
class:
'form-control member-form-control append-right-5 js-member-update-control'
,
id:
"member_access_level_
#{
group
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
=
select_tag
'group_link[group_access]'
,
options_for_select
(
ProjectGroupLink
.
access_options
,
group_link
.
group_access
),
class:
'form-control member-form-control append-right-5 js-member-update-control'
,
id:
"member_access_level_
#{
group
.
id
}
"
,
disabled:
!
can?
(
current_user
,
:admin_project_member
,
@project
)
.prepend-left-5.clearable-input.member-form-control
.prepend-left-5.clearable-input.member-form-control
=
text_field_tag
'group_link[expires_at]'
,
group_link
.
expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
group
.
id
}
"
,
disabled:
!
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
=
text_field_tag
'group_link[expires_at]'
,
group_link
.
expires_at
,
class:
'form-control js-access-expiration-date js-member-update-control'
,
placeholder:
'Expiration date'
,
id:
"member_expires_at_
#{
group
.
id
}
"
,
disabled:
!
can?
(
current_user
,
:admin_project_member
,
@project
)
%i
.clear-icon.js-clear-input
%i
.clear-icon.js-clear-input
-
if
can?
(
current_user
,
action_member_permission
(
:admin
,
group
),
group
)
-
if
can?
(
current_user
,
:admin_project_member
,
@project
)
=
link_to
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
=
link_to
namespace_project_group_link_path
(
@project
.
namespace
,
@project
,
group_link
),
remote:
true
,
remote:
true
,
method: :delete
,
method: :delete
,
...
...
spec/features/projects/members/group_links_spec.rb
0 → 100644
View file @
e747626f
require
'spec_helper'
feature
'Projects > Members > Anonymous user sees members'
,
feature:
true
,
js:
true
do
include
WaitForAjax
let
(
:user
)
{
create
(
:user
)
}
let
(
:group
)
{
create
(
:group
,
:public
)
}
let
(
:project
)
{
create
(
:empty_project
,
:public
)
}
background
do
project
.
team
<<
[
user
,
:master
]
@group_link
=
create
(
:project_group_link
,
project:
project
,
group:
group
)
login_as
(
user
)
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
end
it
'updates group access level'
do
select
'Guest'
,
from:
"member_access_level_
#{
group
.
id
}
"
wait_for_ajax
visit
namespace_project_project_members_path
(
project
.
namespace
,
project
)
expect
(
page
).
to
have_select
(
"member_access_level_
#{
group
.
id
}
"
,
selected:
'Guest'
)
end
it
'updates expiry date'
do
tomorrow
=
Date
.
today
+
3
fill_in
"member_expires_at_
#{
group
.
id
}
"
,
with:
tomorrow
.
strftime
(
"%F"
)
wait_for_ajax
page
.
within
(
first
(
'li.member'
))
do
expect
(
page
).
to
have_content
(
'Expires in 3 days'
)
end
end
end
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