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
47899fb3
Commit
47899fb3
authored
Aug 23, 2018
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow to disable packages feature per project
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
0f024c82
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
67 additions
and
1 deletion
+67
-1
app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
...projects/shared/permissions/components/settings_panel.vue
+24
-0
db/schema.rb
db/schema.rb
+2
-1
ee/app/controllers/ee/projects_controller.rb
ee/app/controllers/ee/projects_controller.rb
+1
-0
ee/app/helpers/ee/projects_helper.rb
ee/app/helpers/ee/projects_helper.rb
+15
-0
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+7
-0
ee/db/migrate/20180823132905_add_packages_enabled_to_project.rb
...migrate/20180823132905_add_packages_enabled_to_project.rb
+18
-0
No files found.
app/assets/javascripts/pages/projects/shared/permissions/components/settings_panel.vue
View file @
47899fb3
...
...
@@ -38,6 +38,11 @@
required
:
false
,
default
:
false
,
},
packagesAvailable
:
{
type
:
Boolean
,
required
:
false
,
default
:
false
,
},
visibilityHelpPath
:
{
type
:
String
,
required
:
false
,
...
...
@@ -50,6 +55,10 @@
type
:
String
,
required
:
false
,
},
packagesHelpPath
:
{
type
:
String
,
required
:
false
,
},
},
data
()
{
...
...
@@ -64,6 +73,7 @@
snippetsAccessLevel
:
20
,
containerRegistryEnabled
:
true
,
lfsEnabled
:
true
,
packagesEnabled
:
true
,
requestAccessEnabled
:
true
,
highlightChangesClass
:
false
,
};
...
...
@@ -129,12 +139,14 @@
if
(
value
===
0
)
{
this
.
containerRegistryEnabled
=
false
;
this
.
lfsEnabled
=
false
;
this
.
packagesEnabled
=
false
;
}
}
else
if
(
oldValue
===
0
)
{
this
.
mergeRequestsAccessLevel
=
value
;
this
.
buildsAccessLevel
=
value
;
this
.
containerRegistryEnabled
=
true
;
this
.
lfsEnabled
=
true
;
this
.
packagesEnabled
=
true
;
}
},
...
...
@@ -300,6 +312,18 @@
name=
"project[lfs_enabled]"
/>
</project-setting-row>
<project-setting-row
v-if=
"packagesAvailable"
:help-path=
"packagesHelpPath"
label=
"Packages"
help-text=
"Every project can have its own space to store its Maven packages"
>
<project-feature-toggle
v-model=
"packagesEnabled"
:disabled-input=
"!repositoryEnabled"
name=
"project[packages_enabled]"
/>
</project-setting-row>
</div>
<project-setting-row
label=
"Wiki"
...
...
db/schema.rb
View file @
47899fb3
...
...
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
ActiveRecord
::
Schema
.
define
(
version:
201808
16193530
)
do
ActiveRecord
::
Schema
.
define
(
version:
201808
23132905
)
do
# These are extensions that must be enabled in order to support this database
enable_extension
"plpgsql"
...
...
@@ -2229,6 +2229,7 @@ ActiveRecord::Schema.define(version: 20180816193530) do
t
.
boolean
"mirror_overwrites_diverged_branches"
t
.
boolean
"pages_https_only"
,
default:
true
t
.
string
"external_webhook_token"
t
.
boolean
"packages_enabled"
,
default:
false
,
null:
false
end
add_index
"projects"
,
[
"ci_id"
],
name:
"index_projects_on_ci_id"
,
using: :btree
...
...
ee/app/controllers/ee/projects_controller.rb
View file @
47899fb3
...
...
@@ -22,6 +22,7 @@ module EE
external_authorization_classification_label
ci_cd_only
use_custom_template
packages_enabled
]
if
allow_mirror_params?
...
...
ee/app/helpers/ee/projects_helper.rb
View file @
47899fb3
...
...
@@ -28,6 +28,21 @@ module EE
nav_tabs
end
override
:project_permissions_settings
def
project_permissions_settings
super
.
merge
(
packagesEnabled:
!!
project
.
packages_enabled
)
end
override
:project_permissions_panel_data
def
project_permissions_panel_data
super
.
merge
(
packagesAvailable:
Gitlab
.
config
.
packages
.
enabled
,
packagesHelpPath:
help_page_path
(
'user/project/maven_packages'
)
)
end
override
:default_url_to_repo
def
default_url_to_repo
(
project
=
@project
)
case
default_clone_protocol
...
...
ee/app/policies/ee/project_policy.rb
View file @
47899fb3
...
...
@@ -23,6 +23,9 @@ module EE
with_scope
:subject
condition
(
:deploy_board_disabled
)
{
!
@subject
.
feature_available?
(
:deploy_board
)
}
with_scope
:subject
condition
(
:packages_disabled
)
{
!
@subject
.
packages_enabled
}
with_scope
:subject
condition
(
:classification_label_authorized
,
score:
32
)
do
EE
::
Gitlab
::
ExternalAuthorization
.
access_allowed?
(
...
...
@@ -110,6 +113,10 @@ module EE
rule
{
deploy_board_disabled
&
~
is_development
}.
prevent
:read_deploy_board
rule
{
packages_disabled
}.
policy
do
prevent
(
*
create_read_update_admin_destroy
(
:package
))
end
rule
{
can?
(
:maintainer_access
)
}.
policy
do
enable
:push_code_to_protected_branches
enable
:admin_path_locks
...
...
ee/db/migrate/20180823132905_add_packages_enabled_to_project.rb
0 → 100644
View file @
47899fb3
# frozen_string_literal: true
class
AddPackagesEnabledToProject
<
ActiveRecord
::
Migration
include
Gitlab
::
Database
::
MigrationHelpers
DOWNTIME
=
false
disable_ddl_transaction!
def
up
add_column_with_default
(
:projects
,
:packages_enabled
,
:boolean
,
default:
false
,
allow_null:
false
)
end
def
down
if
column_exists?
(
:projects
,
:packages_enabled
)
remove_column
(
:projects
,
:packages_enabled
)
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