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
163766d1
Commit
163766d1
authored
Apr 03, 2020
by
David Kim
Committed by
Marcia Ramos
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only display mirrored URL to users who can manage Repository settings
parent
99842868
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
52 additions
and
10 deletions
+52
-10
changelogs/unreleased/34079-mirrored-url-visible-for-users-despite-no-access-to-repositories.yml
...l-visible-for-users-despite-no-access-to-repositories.yml
+5
-0
doc/user/project/repository/repository_mirroring.md
doc/user/project/repository/repository_mirroring.md
+4
-0
ee/app/helpers/ee/mirror_helper.rb
ee/app/helpers/ee/mirror_helper.rb
+1
-1
ee/app/views/projects/_home_mirror.html.haml
ee/app/views/projects/_home_mirror.html.haml
+4
-3
ee/app/views/shared/_mirror_status.html.haml
ee/app/views/shared/_mirror_status.html.haml
+1
-1
ee/spec/features/projects/show_project_spec.rb
ee/spec/features/projects/show_project_spec.rb
+34
-2
ee/spec/views/shared/_mirror_status.html.haml_spec.rb
ee/spec/views/shared/_mirror_status.html.haml_spec.rb
+3
-3
No files found.
changelogs/unreleased/34079-mirrored-url-visible-for-users-despite-no-access-to-repositories.yml
0 → 100644
View file @
163766d1
---
title
:
Only display mirrored URL to users who can manage Repository settings
merge_request
:
27166
author
:
type
:
changed
doc/user/project/repository/repository_mirroring.md
View file @
163766d1
...
...
@@ -28,6 +28,10 @@ immediate update, unless:
-
The mirror is already being updated.
-
5 minutes haven't elapsed since its last update.
For security reasons, from
[
GitLab 12.10 onwards
](
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27166
)
,
the URL to the original repository is only displayed to users with
Maintainer or Owner permissions to the mirrored project.
## Use cases
The following are some possible use cases for repository mirroring:
...
...
ee/app/helpers/ee/mirror_helper.rb
View file @
163766d1
...
...
@@ -4,7 +4,7 @@ module EE
module
MirrorHelper
def
render_mirror_failed_message
(
raw_message
:)
mirror_last_update_at
=
@project
.
import_state
.
last_update_at
message
=
"
The repository failed to update
#{
time_ago_with_tooltip
(
mirror_last_update_at
)
}
."
.
html_safe
message
=
"
Pull mirroring failed
#{
time_ago_with_tooltip
(
mirror_last_update_at
)
}
."
.
html_safe
return
message
if
raw_message
...
...
ee/app/views/projects/_home_mirror.html.haml
View file @
163766d1
-
if
@project
.
mirror?
-
import_url
=
@project
.
safe_import_url
%p
Mirrored from
#{
link_to
import_url
,
import_url
}
.
%br
-
if
can?
(
current_user
,
:admin_project
,
@project
)
-
import_url
=
@project
.
safe_import_url
Mirrored from
#{
link_to
import_url
,
import_url
}
.
%br
=
render
"shared/mirror_status"
ee/app/views/shared/_mirror_status.html.haml
View file @
163766d1
...
...
@@ -3,7 +3,7 @@
-
case
@project
.
import_state
.
last_update_status
-
when
:success
U
pdated
#{
time_ago_with_tooltip
(
last_successful_update_at
)
}
.
Pull mirroring u
pdated
#{
time_ago_with_tooltip
(
last_successful_update_at
)
}
.
-
when
:failed
=
render_mirror_failed_message
(
raw_message:
raw_message
)
...
...
ee/spec/features/projects/show_project_spec.rb
View file @
163766d1
...
...
@@ -3,9 +3,9 @@
require
'spec_helper'
describe
'Project show page'
,
:feature
do
describe
'stat button existence'
do
let
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
describe
'stat button existence'
do
describe
'populated project'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:repository
)
}
...
...
@@ -30,4 +30,36 @@ describe 'Project show page', :feature do
end
end
end
describe
'pull mirroring information'
do
let_it_be
(
:project
)
do
create
(
:project
,
:repository
,
mirror:
true
,
mirror_user:
user
,
import_url:
'http://user:pass@test.com'
)
end
context
'for maintainer'
do
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
visit
project_path
(
project
)
end
it
'displays mirrored from url'
do
expect
(
page
).
to
have_content
(
"Mirrored from http://*****:*****@test.com"
)
end
end
context
'for guest'
do
before
do
project
.
add_guest
(
user
)
sign_in
(
user
)
visit
project_path
(
project
)
end
it
'does not display mirrored from url'
do
expect
(
page
).
not_to
have_content
(
"Mirrored from http://*****:*****@test.com"
)
end
end
end
end
ee/spec/views/shared/_mirror_status.html.haml_spec.rb
View file @
163766d1
...
...
@@ -25,7 +25,7 @@ describe 'shared/_mirror_status.html.haml' do
render
'shared/mirror_status'
expect
(
rendered
).
to
have_content
(
"
U
pdated"
)
expect
(
rendered
).
to
have_content
(
"
Pull mirroring u
pdated"
)
end
end
...
...
@@ -39,13 +39,13 @@ describe 'shared/_mirror_status.html.haml' do
it
'renders failure message'
do
render
'shared/mirror_status'
,
raw_message:
true
expect
(
rendered
).
to
have_content
(
"
The repository failed to update
"
)
expect
(
rendered
).
to
have_content
(
"
Pull mirroring failed
"
)
end
it
'renders failure message with icon'
do
render
'shared/mirror_status'
expect
(
rendered
).
to
have_content
(
'The repository failed to update'
)
expect
(
rendered
).
to
have_content
(
"Pull mirroring failed"
)
expect
(
rendered
).
to
have_css
(
'i'
,
class:
'fa-warning fa-triangle'
)
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