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
6350b32a
Commit
6350b32a
authored
Jan 25, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix security issues with teams
parent
3ddd9f75
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
7 deletions
+16
-7
app/controllers/dashboard_controller.rb
app/controllers/dashboard_controller.rb
+1
-1
app/controllers/teams_controller.rb
app/controllers/teams_controller.rb
+3
-6
app/helpers/application_helper.rb
app/helpers/application_helper.rb
+1
-0
app/models/user.rb
app/models/user.rb
+11
-0
No files found.
app/controllers/dashboard_controller.rb
View file @
6350b32a
...
...
@@ -18,7 +18,7 @@ class DashboardController < ApplicationController
@projects
end
@teams
=
(
UserTeam
.
with_member
(
current_user
)
+
UserTeam
.
created_by
(
current_user
)).
uniq
@teams
=
current_user
.
authorized_teams
@projects
=
@projects
.
page
(
params
[
:page
]).
per
(
30
)
...
...
app/controllers/teams_controller.rb
View file @
6350b32a
...
...
@@ -4,11 +4,9 @@ class TeamsController < ApplicationController
before_filter
:authorize_manage_user_team!
,
only:
[
:edit
,
:update
]
before_filter
:authorize_admin_user_team!
,
only:
[
:destroy
]
layout
'user_team'
,
except:
[
:new
,
:create
]
before_filter
:user_team
,
except:
[
:new
,
:create
]
def
index
@teams
=
current_user
.
user_teams
.
order
(
'name ASC'
)
end
layout
'user_team'
,
except:
[
:new
,
:create
]
def
show
user_team
...
...
@@ -83,7 +81,6 @@ class TeamsController < ApplicationController
end
def
user_team
@team
||=
UserTeam
.
find_by_path
(
params
[
:id
])
@team
||=
current_user
.
authorized_teams
.
find_by_path
(
params
[
:id
])
end
end
app/helpers/application_helper.rb
View file @
6350b32a
...
...
@@ -74,6 +74,7 @@ module ApplicationHelper
def
search_autocomplete_source
projects
=
current_user
.
authorized_projects
.
map
{
|
p
|
{
label:
"project:
#{
p
.
name_with_namespace
}
"
,
url:
project_path
(
p
)
}
}
groups
=
current_user
.
authorized_groups
.
map
{
|
group
|
{
label:
"group:
#{
group
.
name
}
"
,
url:
group_path
(
group
)
}
}
teams
=
current_user
.
authorized_teams
.
map
{
|
team
|
{
label:
"team:
#{
team
.
name
}
"
,
url:
team_path
(
team
)
}
}
default_nav
=
[
{
label:
"My Profile"
,
url:
profile_path
},
...
...
app/models/user.rb
View file @
6350b32a
...
...
@@ -295,4 +295,15 @@ class User < ActiveRecord::Base
def
namespace_id
namespace
.
try
:id
end
def
authorized_teams
@authorized_teams
||=
begin
ids
=
[]
ids
<<
UserTeam
.
with_member
(
self
).
pluck
(
'user_teams.id'
)
ids
<<
UserTeam
.
created_by
(
self
).
pluck
(
'user_teams.id'
)
ids
.
flatten
UserTeam
.
where
(
id:
ids
)
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