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
Kazuhiko Shiozaki
gitlab-ce
Commits
1b8f0820
Commit
1b8f0820
authored
Dec 07, 2011
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
new access rights implemented
parent
68154e8f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
65 additions
and
81 deletions
+65
-81
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+1
-1
app/views/admin/projects/show.html.haml
app/views/admin/projects/show.html.haml
+6
-7
app/views/admin/team_members/_form.html.haml
app/views/admin/team_members/_form.html.haml
+14
-9
app/views/admin/team_members/index.html.haml
app/views/admin/team_members/index.html.haml
+9
-9
app/views/admin/team_members/show.html.haml
app/views/admin/team_members/show.html.haml
+5
-11
app/views/admin/users/show.html.haml
app/views/admin/users/show.html.haml
+4
-6
app/views/projects/_team.html.haml
app/views/projects/_team.html.haml
+1
-1
app/views/team_members/_form.html.haml
app/views/team_members/_form.html.haml
+7
-8
app/views/team_members/new.js.haml
app/views/team_members/new.js.haml
+2
-1
spec/models/note_spec.rb
spec/models/note_spec.rb
+9
-9
spec/requests/team_members_spec.rb
spec/requests/team_members_spec.rb
+7
-19
No files found.
app/controllers/projects_controller.rb
View file @
1b8f0820
...
@@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
...
@@ -30,7 +30,7 @@ class ProjectsController < ApplicationController
Project
.
transaction
do
Project
.
transaction
do
@project
.
save!
@project
.
save!
@project
.
users_projects
.
create!
(
:
admin
=>
true
,
:read
=>
true
,
:write
=>
true
,
:user
=>
current_user
)
@project
.
users_projects
.
create!
(
:
repo_access
=>
Repository
::
REPO_RW
,
:project_access
=>
Project
::
PROJECT_RWA
,
:user
=>
current_user
)
# when project saved no team member exist so
# when project saved no team member exist so
# project repository should be updated after first user add
# project repository should be updated after first user add
...
...
app/views/admin/projects/show.html.haml
View file @
1b8f0820
...
@@ -43,18 +43,17 @@
...
@@ -43,18 +43,17 @@
%tr
%tr
%th
Name
%th
Name
%th
Added
%th
Added
%th
Web
%th
Project Access
%th
Git
%th
Repository Access
%th
Admin
%th
%th
-
@admin_project
.
users_projects
.
each
do
|
tm
|
-
@admin_project
.
users_projects
.
each
do
|
tm
|
%tr
%tr
%td
=
link_to
tm
.
user_name
,
admin_team_member_path
(
tm
)
%td
=
link_to
tm
.
user_name
,
admin_team_member_path
(
tm
)
%td
=
time_ago_in_words
(
tm
.
updated_at
)
+
" ago"
%td
=
time_ago_in_words
(
tm
.
updated_at
)
+
" ago"
%td
=
check_box_tag
"read"
,
1
,
@admin_project
.
readers
.
include?
(
tm
.
user
),
:disabled
=>
:disabled
%td
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
,
tm
.
project_access
),
:class
=>
"project-access-select"
,
:disabled
=>
:disabled
%td
=
check_box_tag
"commit"
,
1
,
@admin_project
.
writers
.
include?
(
tm
.
user
),
:disabled
=>
:disabled
%td
=
select_tag
:repo_access
,
options_for_select
(
Repository
.
access_options
,
tm
.
repo_access
),
:class
=>
"repo-access-select"
,
:disabled
=>
:disabled
%td
.span-2
=
check_box_tag
"admin"
,
1
,
@admin_project
.
admins
.
include?
(
tm
.
user
),
:disabled
=>
:disabled
%td
=
link_to
'Destroy'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
%td
=
link_to
'Destroy'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
=
link_to
'New Team Member'
,
new_admin_team_member_path
(
:team_member
=>
{
:project_id
=>
@admin_project
.
id
}),
:class
=>
"grey-button"
=
link_to
'New Team Member'
,
new_admin_team_member_path
(
:team_member
=>
{
:project_id
=>
@admin_project
.
id
}),
:class
=>
"grey-button"
app/views/admin/team_members/_form.html.haml
View file @
1b8f0820
...
@@ -17,21 +17,26 @@
...
@@ -17,21 +17,26 @@
=
f
.
select
:project_id
,
Project
.
all
.
map
{
|
user
|
[
user
.
name
,
user
.
id
]
}
=
f
.
select
:project_id
,
Project
.
all
.
map
{
|
user
|
[
user
.
name
,
user
.
id
]
}
.span-6
.span-6
%b
Access:
%b
Project
Access:
.span-6
.span-6
=
f
.
check_box
:read
=
f
.
select
:project_access
,
options_for_select
(
Project
.
access_options
,
@admin_team_member
.
project_access
),
{},
:class
=>
"project-access-select"
Web Access (Browse Repo)
.span-6
.span-6
=
f
.
check_box
:write
%b
Repository Access:
Git Access (User will be added to commiters list)
.span-6
.span-6
=
f
.
check_box
:admin
=
f
.
select
:repo_access
,
options_for_select
(
Repository
.
access_options
,
@admin_team_member
.
repo_access
),
{},
:class
=>
"repo-access-select"
Admin (Can manage project)
%br
%br
.actions
.actions
=
f
.
submit
'Save'
,
:class
=>
"grey-button"
=
f
.
submit
'Save'
,
:class
=>
"grey-button"
:css
form
select
{
width
:
300px
;
}
:javascript
:javascript
$
(
'
select#team_member_user_id
'
).
selectmenu
({
width
:
300
});
$
(
'
select#team_member_user_id
'
).
chosen
();
$
(
'
select#team_member_project_id
'
).
selectmenu
({
width
:
300
});
$
(
'
select#team_member_project_id
'
).
chosen
();
$
(
'
select#team_member_repo_access
'
).
chosen
();
$
(
'
select#team_member_project_access
'
).
chosen
();
app/views/admin/team_members/index.html.haml
View file @
1b8f0820
...
@@ -3,21 +3,21 @@
...
@@ -3,21 +3,21 @@
%table
%table
%thead
%thead
%th
Name
%th
Name
%th
Email
%th
Project Access
%th
Read
%th
Repo Access
%th
Git
%th
Manage
%th
Added
%th
Added
%th
%th
%th
%th
-
members
.
each
do
|
tm
|
-
members
.
each
do
|
tm
|
-
user
=
tm
.
user
-
user
=
tm
.
user
%tr
%tr
%td
.span-6
=
link_to
tm
.
user_name
,
admin_team_member_path
(
tm
)
%td
.span-6
%td
.span-6
=
tm
.
user_email
=
link_to
tm
.
user_name
,
admin_team_member_path
(
tm
)
%td
.span-1
=
check_box_tag
"read"
,
1
,
project
.
readers
.
include?
(
user
),
:disabled
=>
:disabled
%br
%td
.span-1
=
check_box_tag
"commit"
,
1
,
project
.
writers
.
include?
(
user
),
:disabled
=>
:disabled
%br
%td
.span-2
=
check_box_tag
"admin"
,
1
,
project
.
admins
.
include?
(
user
),
:disabled
=>
:disabled
=
tm
.
user_email
%td
.span-3
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
,
tm
.
project_access
),
:class
=>
"project-access-select"
,
:disabled
=>
:disabled
%td
.span-3
=
select_tag
:repo_access
,
options_for_select
(
Repository
.
access_options
,
tm
.
repo_access
),
:class
=>
"repo-access-select"
,
:disabled
=>
:disabled
%td
.span-3
=
time_ago_in_words
(
tm
.
updated_at
)
+
" ago"
%td
.span-3
=
time_ago_in_words
(
tm
.
updated_at
)
+
" ago"
%td
=
link_to
'Edit'
,
edit_admin_team_member_path
(
tm
),
:id
=>
"edit_
#{
dom_id
(
tm
)
}
"
%td
=
link_to
'Edit'
,
edit_admin_team_member_path
(
tm
),
:id
=>
"edit_
#{
dom_id
(
tm
)
}
"
%td
=
link_to
'Destroy'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
%td
=
link_to
'Destroy'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
...
...
app/views/admin/team_members/show.html.haml
View file @
1b8f0820
...
@@ -11,19 +11,13 @@
...
@@ -11,19 +11,13 @@
#infoblock
#infoblock
.span-6
.span-6
%b
Access:
%b
Project Access:
%br
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
,
@admin_team_member
.
project_access
),
:class
=>
"project-access-select"
,
:disabled
=>
true
.span-6
=
check_box_tag
"read"
,
1
,
@admin_team_member
.
read
,
:disabled
=>
:disabled
Web Access (Browse Repo)
%br
%br
.span-6
.span-6
=
check_box_tag
"commit"
,
1
,
@admin_team_member
.
write
,
:disabled
=>
:disabled
%b
Repository Access:
Git Access (User will be added to commiters list)
=
select_tag
:repo_access
,
options_for_select
(
Repository
.
access_options
,
@admin_team_member
.
repo_access
),
:class
=>
"repo-access-select"
,
:disabled
=>
true
%br
.span-6.append-bottom
=
check_box_tag
"admin"
,
1
,
@admin_team_member
.
admin
,
:disabled
=>
:disabled
Admin (Can manage project)
%br
%br
...
...
app/views/admin/users/show.html.haml
View file @
1b8f0820
...
@@ -51,9 +51,8 @@
...
@@ -51,9 +51,8 @@
%thead
%thead
%th
Name
%th
Name
%th
Added
%th
Added
%th
Web
%th
Project Access
%th
Git
%th
Repository Access
%th
Admin
%th
%th
%th
%th
...
@@ -62,9 +61,8 @@
...
@@ -62,9 +61,8 @@
%tr
%tr
%td
=
link_to
project
.
name
,
admin_project_path
(
project
)
%td
=
link_to
project
.
name
,
admin_project_path
(
project
)
%td
=
time_ago_in_words
(
tm
.
updated_at
)
+
" ago"
%td
=
time_ago_in_words
(
tm
.
updated_at
)
+
" ago"
%td
=
check_box_tag
"read"
,
1
,
project
.
readers
.
include?
(
@admin_user
),
:disabled
=>
:disabled
%td
=
select_tag
:project_access
,
options_for_select
(
Project
.
access_options
,
tm
.
project_access
),
:class
=>
"project-access-select"
,
:disabled
=>
:disabled
%td
=
check_box_tag
"commit"
,
1
,
project
.
writers
.
include?
(
@admin_usertm
),
:disabled
=>
:disabled
%td
=
select_tag
:repo_access
,
options_for_select
(
Repository
.
access_options
,
tm
.
repo_access
),
:class
=>
"repo-access-select"
,
:disabled
=>
:disabled
%td
.span-2
=
check_box_tag
"admin"
,
1
,
project
.
admins
.
include?
(
@admin_user
),
:disabled
=>
:disabled
%td
=
link_to
'Edit'
,
edit_admin_team_member_path
(
tm
)
%td
=
link_to
'Edit'
,
edit_admin_team_member_path
(
tm
)
%td
=
link_to
'Cancel'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
%td
=
link_to
'Cancel'
,
admin_team_member_path
(
tm
),
:confirm
=>
'Are you sure?'
,
:method
=>
:delete
...
...
app/views/projects/_team.html.haml
View file @
1b8f0820
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
:javascript
:javascript
$
(
function
(){
$
(
function
(){
$
(
'
.repo-access-select,
.project-access-select
'
).
live
(
"
change
"
,
function
()
{
$
(
'
#team-table .repo-access-select, #team-table
.project-access-select
'
).
live
(
"
change
"
,
function
()
{
$
(
this
.
form
).
submit
();
$
(
this
.
form
).
submit
();
});
});
})
})
...
...
app/views/team_members/_form.html.haml
View file @
1b8f0820
...
@@ -10,16 +10,15 @@
...
@@ -10,16 +10,15 @@
.span-6
.span-6
=
f
.
select
(
:user_id
,
User
.
not_in_project
(
@project
).
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
},
{
:style
=>
"width:300px"
})
=
f
.
select
(
:user_id
,
User
.
not_in_project
(
@project
).
all
.
collect
{
|
p
|
[
p
.
name
,
p
.
id
]
},
{
:include_blank
=>
"Select user"
},
{
:style
=>
"width:300px"
})
.span-6
.span-6
%b
Access:
%b
Project
Access:
.span-6
.span-6
=
f
.
check_box
:read
=
f
.
select
:project_access
,
options_for_select
(
Project
.
access_options
,
@team_member
.
project_access
),
{},
:class
=>
"project-access-select"
Web Access
.span-6
.span-6
=
f
.
check_box
:write
%b
Repository Access:
Git Access
.span-6
.span-6.append-bottom
=
f
.
select
:repo_access
,
options_for_select
(
Repository
.
access_options
,
@team_member
.
repo_access
),
{},
:class
=>
"repo-access-select"
=
f
.
check_box
:admin
Admin
%br
%br
.span-6
.span-6
=
f
.
submit
'Save'
,
:class
=>
"grey-button"
=
f
.
submit
'Save'
,
:class
=>
"grey-button"
app/views/team_members/new.js.haml
View file @
1b8f0820
...
@@ -12,4 +12,5 @@
...
@@ -12,4 +12,5 @@
modal: true
modal: true
});
});
$('select#team_member_user_id').chosen();
$('#team_member_new select#team_member_user_id').chosen();
spec/models/note_spec.rb
View file @
1b8f0820
...
@@ -31,9 +31,9 @@ describe Note do
...
@@ -31,9 +31,9 @@ describe Note do
describe
:read
do
describe
:read
do
before
do
before
do
@p1
.
users_projects
.
create
(
:user
=>
@u1
,
:
read
=>
false
)
@p1
.
users_projects
.
create
(
:user
=>
@u1
,
:
project_access
=>
Project
::
PROJECT_N
)
@p1
.
users_projects
.
create
(
:user
=>
@u2
,
:
read
=>
true
)
@p1
.
users_projects
.
create
(
:user
=>
@u2
,
:
project_access
=>
Project
::
PROJECT_R
)
@p2
.
users_projects
.
create
(
:user
=>
@u3
,
:
read
=>
true
)
@p2
.
users_projects
.
create
(
:user
=>
@u3
,
:
project_access
=>
Project
::
PROJECT_R
)
end
end
it
{
@abilities
.
allowed?
(
@u1
,
:read_note
,
@p1
).
should
be_false
}
it
{
@abilities
.
allowed?
(
@u1
,
:read_note
,
@p1
).
should
be_false
}
...
@@ -43,9 +43,9 @@ describe Note do
...
@@ -43,9 +43,9 @@ describe Note do
describe
:write
do
describe
:write
do
before
do
before
do
@p1
.
users_projects
.
create
(
:user
=>
@u1
,
:
write
=>
false
)
@p1
.
users_projects
.
create
(
:user
=>
@u1
,
:
project_access
=>
Project
::
PROJECT_R
)
@p1
.
users_projects
.
create
(
:user
=>
@u2
,
:
write
=>
true
)
@p1
.
users_projects
.
create
(
:user
=>
@u2
,
:
project_access
=>
Project
::
PROJECT_RW
)
@p2
.
users_projects
.
create
(
:user
=>
@u3
,
:
write
=>
true
)
@p2
.
users_projects
.
create
(
:user
=>
@u3
,
:
project_access
=>
Project
::
PROJECT_RW
)
end
end
it
{
@abilities
.
allowed?
(
@u1
,
:write_note
,
@p1
).
should
be_false
}
it
{
@abilities
.
allowed?
(
@u1
,
:write_note
,
@p1
).
should
be_false
}
...
@@ -55,9 +55,9 @@ describe Note do
...
@@ -55,9 +55,9 @@ describe Note do
describe
:admin
do
describe
:admin
do
before
do
before
do
@p1
.
users_projects
.
create
(
:user
=>
@u1
,
:
admin
=>
false
)
@p1
.
users_projects
.
create
(
:user
=>
@u1
,
:
project_access
=>
Project
::
PROJECT_R
)
@p1
.
users_projects
.
create
(
:user
=>
@u2
,
:
admin
=>
true
)
@p1
.
users_projects
.
create
(
:user
=>
@u2
,
:
project_access
=>
Project
::
PROJECT_RWA
)
@p2
.
users_projects
.
create
(
:user
=>
@u3
,
:
admin
=>
true
)
@p2
.
users_projects
.
create
(
:user
=>
@u3
,
:
project_access
=>
Project
::
PROJECT_RWA
)
end
end
it
{
@abilities
.
allowed?
(
@u1
,
:admin_note
,
@p1
).
should
be_false
}
it
{
@abilities
.
allowed?
(
@u1
,
:admin_note
,
@p1
).
should
be_false
}
...
...
spec/requests/team_members_spec.rb
View file @
1b8f0820
...
@@ -32,11 +32,10 @@ describe "TeamMembers" do
...
@@ -32,11 +32,10 @@ describe "TeamMembers" do
describe
"fill in"
do
describe
"fill in"
do
before
do
before
do
page
.
execute_script
(
"$('#team_member_user_id').show();"
)
page
.
execute_script
(
"$('#team_member_user_id').show();"
)
select
@user_1
.
name
,
:from
=>
"team_member_user_id"
within
"#team_member_new"
do
within
"#team_member_new"
do
check
"team_member_read"
select
@user_1
.
name
,
:from
=>
"team_member_user_id"
check
"team_member_write"
select
"Report"
,
:from
=>
"team_member_project_access"
select
"Pull"
,
:from
=>
"team_member_repo_access"
end
end
end
end
...
@@ -48,20 +47,9 @@ describe "TeamMembers" do
...
@@ -48,20 +47,9 @@ describe "TeamMembers" do
page
.
should
have_content
@user_1
.
name
page
.
should
have_content
@user_1
.
name
@member
.
read
.
should
be_true
@member
.
reload
@member
.
write
.
should
be_true
@member
.
project_access
.
should
==
Project
::
PROJECT_RW
@member
.
admin
.
should
be_false
@member
.
repo_access
.
should
==
Repository
::
REPO_R
end
it
"should not allow creation without access selected"
do
within
"#team_member_new"
do
uncheck
"team_member_read"
uncheck
"team_member_write"
uncheck
"team_member_admin"
end
expect
{
click_button
"Save"
}.
to_not
change
{
UsersProject
.
count
}
page
.
should
have_content
(
"Please choose at least one Role in the Access list"
)
end
end
end
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