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
Jérome Perrin
gitlab-ce
Commits
10960400
Commit
10960400
authored
Nov 29, 2016
by
Z.J. van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update effected tests
parent
617f43c7
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
47 deletions
+45
-47
app/policies/project_policy.rb
app/policies/project_policy.rb
+0
-3
features/steps/shared/project.rb
features/steps/shared/project.rb
+1
-1
spec/features/security/project/private_access_spec.rb
spec/features/security/project/private_access_spec.rb
+25
-24
spec/lib/gitlab/cycle_analytics/permissions_spec.rb
spec/lib/gitlab/cycle_analytics/permissions_spec.rb
+1
-1
spec/policies/project_policy_spec.rb
spec/policies/project_policy_spec.rb
+16
-16
spec/requests/projects/cycle_analytics_events_spec.rb
spec/requests/projects/cycle_analytics_events_spec.rb
+1
-1
spec/workers/pipeline_notification_worker_spec.rb
spec/workers/pipeline_notification_worker_spec.rb
+1
-1
No files found.
app/policies/project_policy.rb
View file @
10960400
...
@@ -12,9 +12,6 @@ class ProjectPolicy < BasePolicy
...
@@ -12,9 +12,6 @@ class ProjectPolicy < BasePolicy
guest_access!
guest_access!
public_access!
public_access!
# Allow to read builds for internal projects
can!
:read_build
if
project
.
public_builds?
if
project
.
request_access_enabled
&&
if
project
.
request_access_enabled
&&
!
(
owner
||
user
.
admin?
||
project
.
team
.
member?
(
user
)
||
project_group_member?
(
user
))
!
(
owner
||
user
.
admin?
||
project
.
team
.
member?
(
user
)
||
project_group_member?
(
user
))
can!
:request_access
can!
:request_access
...
...
features/steps/shared/project.rb
View file @
10960400
...
@@ -9,7 +9,7 @@ module SharedProject
...
@@ -9,7 +9,7 @@ module SharedProject
step
"project exists in some group namespace"
do
step
"project exists in some group namespace"
do
@group
=
create
(
:group
,
name:
'some group'
)
@group
=
create
(
:group
,
name:
'some group'
)
@project
=
create
(
:project
,
namespace:
@group
)
@project
=
create
(
:project
,
namespace:
@group
,
public_builds:
false
)
end
end
# Create a specific project called "Shop"
# Create a specific project called "Shop"
...
...
spec/features/security/project/private_access_spec.rb
View file @
10960400
...
@@ -3,7 +3,7 @@ require 'spec_helper'
...
@@ -3,7 +3,7 @@ require 'spec_helper'
describe
"Private Project Access"
,
feature:
true
do
describe
"Private Project Access"
,
feature:
true
do
include
AccessMatchers
include
AccessMatchers
let
(
:project
)
{
create
(
:project
,
:private
)
}
let
(
:project
)
{
create
(
:project
,
:private
,
public_builds:
false
)
}
describe
"Project should be private"
do
describe
"Project should be private"
do
describe
'#private?'
do
describe
'#private?'
do
...
@@ -262,16 +262,15 @@ describe "Private Project Access", feature: true do
...
@@ -262,16 +262,15 @@ describe "Private Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
context
'when public builds is enabled'
do
context
'when public builds is enabled'
do
it
{
is_expected
.
to
be_allowed_for
guest
}
end
context
'when public buils are disabled'
do
before
do
before
do
project
.
public_builds
=
false
project
.
update
(
public_builds:
true
)
project
.
save
end
end
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_allowed_for
(
:guest
).
of
(
project
)
}
end
context
'when public buils are disabled'
do
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
end
end
end
end
...
@@ -290,16 +289,15 @@ describe "Private Project Access", feature: true do
...
@@ -290,16 +289,15 @@ describe "Private Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
context
'when public builds is enabled'
do
context
'when public builds is enabled'
do
it
{
is_expected
.
to
be_allowed_for
guest
}
end
context
'when public buils are disabled'
do
before
do
before
do
project
.
public_builds
=
false
project
.
update
(
public_builds:
true
)
project
.
save
end
end
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_allowed_for
(
:guest
).
of
(
project
)
}
end
context
'when public buils are disabled'
do
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
end
end
end
end
...
@@ -317,16 +315,15 @@ describe "Private Project Access", feature: true do
...
@@ -317,16 +315,15 @@ describe "Private Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
context
'when public builds is enabled'
do
context
'when public builds is enabled'
do
it
{
is_expected
.
to
be_allowed_for
guest
}
end
context
'when public buils are disabled'
do
before
do
before
do
project
.
public_builds
=
false
project
.
update
(
public_builds:
true
)
project
.
save
end
end
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_allowed_for
(
:guest
).
of
(
project
)
}
end
context
'when public buils are disabled'
do
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
end
end
end
end
...
@@ -346,7 +343,11 @@ describe "Private Project Access", feature: true do
...
@@ -346,7 +343,11 @@ describe "Private Project Access", feature: true do
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
it
{
is_expected
.
to
be_denied_for
(
:visitor
)
}
context
'when public builds is enabled'
do
context
'when public builds is enabled'
do
it
{
is_expected
.
to
be_allowed_for
guest
}
before
do
project
.
update
(
public_builds:
true
)
end
it
{
is_expected
.
to
be_allowed_for
(
:guest
).
of
(
project
)
}
end
end
context
'when public buils are disabled'
do
context
'when public buils are disabled'
do
...
@@ -355,7 +356,7 @@ describe "Private Project Access", feature: true do
...
@@ -355,7 +356,7 @@ describe "Private Project Access", feature: true do
project
.
save
project
.
save
end
end
it
{
is_expected
.
to
be_denied_for
guest
}
it
{
is_expected
.
to
be_denied_for
(
:guest
).
of
(
project
)
}
end
end
end
end
...
...
spec/lib/gitlab/cycle_analytics/permissions_spec.rb
View file @
10960400
require
'spec_helper'
require
'spec_helper'
describe
Gitlab
::
CycleAnalytics
::
Permissions
do
describe
Gitlab
::
CycleAnalytics
::
Permissions
do
let
(
:project
)
{
create
(
:empty_project
)
}
let
(
:project
)
{
create
(
:empty_project
,
public_builds:
false
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
subject
{
described_class
.
get
(
user:
user
,
project:
project
)
}
subject
{
described_class
.
get
(
user:
user
,
project:
project
)
}
...
...
spec/policies/project_policy_spec.rb
View file @
10960400
...
@@ -111,34 +111,34 @@ describe ProjectPolicy, models: true do
...
@@ -111,34 +111,34 @@ describe ProjectPolicy, models: true do
context
'guests'
do
context
'guests'
do
let
(
:current_user
)
{
guest
}
let
(
:current_user
)
{
guest
}
context
'public builds enabled'
do
let
(
:reporter_public_build_permissions
)
do
let
(
:reporter_public_build_permissions
)
do
reporter_permissions
-
[
:read_build
,
:read_pipeline
]
reporter_permissions
-
[
:read_build
,
:read_pipeline
]
end
end
it
do
is_expected
.
to
include
(
*
guest_permissions
)
is_expected
.
not_to
include
(
*
reporter_public_build_permissions
)
is_expected
.
not_to
include
(
*
team_member_reporter_permissions
)
is_expected
.
not_to
include
(
*
developer_permissions
)
is_expected
.
not_to
include
(
*
master_permissions
)
is_expected
.
not_to
include
(
*
owner_permissions
)
end
context
'public builds enabled'
do
it
do
it
do
is_expected
.
to
include
(
*
guest_permissions
)
is_expected
.
to
include
(
*
guest_permissions
)
is_expected
.
not_to
include
(
*
reporter_public_build_permissions
)
is_expected
.
to
include
(
:read_build
,
:read_pipeline
)
is_expected
.
not_to
include
(
*
team_member_reporter_permissions
)
is_expected
.
not_to
include
(
*
developer_permissions
)
is_expected
.
not_to
include
(
*
master_permissions
)
is_expected
.
not_to
include
(
*
owner_permissions
)
end
end
end
end
context
'public builds disabled'
do
context
'public builds disabled'
do
before
do
before
do
project
.
public_builds
=
false
project
.
update
(
public_builds:
false
)
project
.
save
end
end
it
do
it
do
is_expected
.
to
include
(
*
guest_permissions
)
is_expected
.
to
include
(
*
guest_permissions
)
is_expected
.
not_to
include
(
*
reporter_permissions
)
is_expected
.
not_to
include
(
:read_build
,
:read_pipeline
)
is_expected
.
not_to
include
(
*
team_member_reporter_permissions
)
is_expected
.
not_to
include
(
*
developer_permissions
)
is_expected
.
not_to
include
(
*
master_permissions
)
is_expected
.
not_to
include
(
*
owner_permissions
)
end
end
end
end
end
end
...
...
spec/requests/projects/cycle_analytics_events_spec.rb
View file @
10960400
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
'cycle analytics events'
do
describe
'cycle analytics events'
do
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
public_builds:
false
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
let
(
:issue
)
{
create
(
:issue
,
project:
project
,
created_at:
2
.
days
.
ago
)
}
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
do
describe
'GET /:namespace/:project/cycle_analytics/events/issues'
do
...
...
spec/workers/pipeline_notification_worker_spec.rb
View file @
10960400
...
@@ -11,7 +11,7 @@ describe PipelineNotificationWorker do
...
@@ -11,7 +11,7 @@ describe PipelineNotificationWorker do
status:
status
)
status:
status
)
end
end
let
(
:project
)
{
create
(
:project
)
}
let
(
:project
)
{
create
(
:project
,
public_builds:
false
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:user
)
{
create
(
:user
)
}
let
(
:pusher
)
{
user
}
let
(
:pusher
)
{
user
}
let
(
:watcher
)
{
pusher
}
let
(
:watcher
)
{
pusher
}
...
...
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