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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
348653bc
Commit
348653bc
authored
Aug 20, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ProjectGroupLink access level
Now you can specify max access level for shared projects
parent
a48fffc4
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
11 deletions
+38
-11
app/controllers/projects/group_links_controller.rb
app/controllers/projects/group_links_controller.rb
+1
-0
app/models/project_group_link.rb
app/models/project_group_link.rb
+8
-0
app/models/project_team.rb
app/models/project_team.rb
+16
-4
app/views/projects/group_links/index.html.haml
app/views/projects/group_links/index.html.haml
+2
-2
db/migrate/20130820102832_add_access_to_project_group_link.rb
...igrate/20130820102832_add_access_to_project_group_link.rb
+5
-0
db/schema.rb
db/schema.rb
+6
-5
No files found.
app/controllers/projects/group_links_controller.rb
View file @
348653bc
...
...
@@ -18,6 +18,7 @@ class Projects::GroupLinksController < Projects::ApplicationController
def
create
link
=
project
.
project_group_links
.
new
link
.
group_id
=
params
[
:group_id
]
link
.
group_access
=
params
[
:group_access
]
link
.
save
redirect_to
project_group_links_path
(
project
)
...
...
app/models/project_group_link.rb
View file @
348653bc
...
...
@@ -25,4 +25,12 @@ class ProjectGroupLink < ActiveRecord::Base
"Master"
=>
MASTER
}
end
def
self
.
default_access
DEVELOPER
end
def
human_access
self
.
class
.
access_options
.
key
(
self
.
group_access
)
end
end
app/models/project_team.rb
View file @
348653bc
...
...
@@ -114,15 +114,27 @@ class ProjectTeam
invited_members
=
[]
if
project
.
invited_groups
.
any?
project
.
invited_groups
.
each
do
|
invited_group
|
project
.
project_group_links
.
each
do
|
group_link
|
invited_group
=
group_link
.
group
im
=
invited_group
.
users_groups
if
level
if
level
==
:masters
im
=
im
.
owners
+
im
.
masters
int_level
=
UsersGroup
.
group_access_roles
[
level
.
to_s
.
singularize
.
titleize
]
# Skip group members if we ask for masters
# but max group access is developers
next
if
int_level
>
group_link
.
group_access
# If we ask for developers and max
# group access is developers we need to provide
# both group master, developers as devs
if
int_level
==
group_link
.
group_access
im
.
where
(
"group_access >= ?)"
,
group_link
.
group_access
)
else
im
=
im
.
send
(
level
)
im
.
send
(
level
)
end
end
invited_members
<<
im
end
...
...
app/views/projects/group_links/index.html.haml
View file @
348653bc
...
...
@@ -17,7 +17,7 @@
=
link_to
group
do
%i
.icon-folder-open
=
group
.
name
%small
.light
up to
Masters
%small
.light
up to
#{
group_link
.
human_access
}
.span5.available-groups
%h4
...
...
@@ -27,7 +27,7 @@
%li
.pull-right
=
form_tag
project_group_links_path
(
@project
),
method: :post
do
=
select_tag
:group_access
,
options_for_select
(
ProjectGroupLink
.
access_options
,
ProjectGroupLink
::
MASTER
),
class:
"span2"
=
select_tag
:group_access
,
options_for_select
(
ProjectGroupLink
.
access_options
,
ProjectGroupLink
.
default_access
),
class:
"span2"
=
hidden_field_tag
:group_id
,
group
.
id
=
submit_tag
"Share"
,
class:
"btn btn-small"
%h4
...
...
db/migrate/20130820102832_add_access_to_project_group_link.rb
0 → 100644
View file @
348653bc
class
AddAccessToProjectGroupLink
<
ActiveRecord
::
Migration
def
change
add_column
:project_group_links
,
:group_access
,
:integer
,
null:
false
,
default:
ProjectGroupLink
.
default_access
end
end
db/schema.rb
View file @
348653bc
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
:version
=>
201308
12143708
)
do
ActiveRecord
::
Schema
.
define
(
:version
=>
201308
20102832
)
do
create_table
"deploy_keys_projects"
,
:force
=>
true
do
|
t
|
t
.
integer
"deploy_key_id"
,
:null
=>
false
...
...
@@ -162,10 +162,11 @@ ActiveRecord::Schema.define(:version => 20130812143708) do
add_index
"notes"
,
[
"project_id"
],
:name
=>
"index_notes_on_project_id"
create_table
"project_group_links"
,
:force
=>
true
do
|
t
|
t
.
integer
"project_id"
,
:null
=>
false
t
.
integer
"group_id"
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
integer
"project_id"
,
:null
=>
false
t
.
integer
"group_id"
,
:null
=>
false
t
.
datetime
"created_at"
,
:null
=>
false
t
.
datetime
"updated_at"
,
:null
=>
false
t
.
integer
"group_access"
,
:default
=>
30
,
:null
=>
false
end
create_table
"projects"
,
:force
=>
true
do
|
t
|
...
...
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