Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Gitlab-External-Templates
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adri
Gitlab-External-Templates
Commits
fbf692dd
Commit
fbf692dd
authored
5 years ago
by
Vladimir Shushlin
Browse files
Options
Downloads
Patches
Plain Diff
WIP: update pages access control setting on deploy
parent
5cdfbd83
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/services/projects/update_pages_configuration_service.rb
+19
-0
19 additions, 0 deletions
app/services/projects/update_pages_configuration_service.rb
with
19 additions
and
0 deletions
app/services/projects/update_pages_configuration_service.rb
+
19
−
0
View file @
fbf692dd
...
...
@@ -11,6 +11,8 @@ def initialize(project)
end
def
execute
update_access_control_settings_if_needed
if
file_equals?
(
pages_config_file
,
pages_config_json
)
return
success
(
reload:
false
)
end
...
...
@@ -101,5 +103,22 @@ def read_file(file)
rescue
nil
end
# The default for pages access settings is private,
# but if access control is disabled on the instance level
# pages will be available without access control.
# If access control is then enabled on the isntance level,
# these sites will suddenly become private.
# To avoid this situation we change the project setting to public
# when we deploy pages site
def
update_access_control_settings_if_needed
return
if
Gitlab
.
config
.
pages
.
access_control
# only fix PRIVATE pages sites
return
unless
project
.
pages_access_level
==
ProjectFeature
::
PRIVATE
new_access_level
=
project
.
public?
?
ProjectFeature
::
ENABLED
:
ProjectFeature
::
PUBLIC
project
.
update_column
(
:pages_access_level
,
new_access_level
)
end
end
end
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment