diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 18:08:47 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-01-22 18:08:47 +0000 |
commit | 3832718d895bf8268f3e3aac85948e2792769345 (patch) | |
tree | 4a322399af568b6203e732ae2e2f3efc39b23a67 /app | |
parent | 180cd023a11c0eb413ad0de124d9758ea25672bd (diff) | |
download | gitlab-ce-3832718d895bf8268f3e3aac85948e2792769345.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/self_monitor/index.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/self_monitor/store/actions.js | 3 | ||||
-rw-r--r-- | app/assets/javascripts/self_monitor/store/state.js | 4 | ||||
-rw-r--r-- | app/controllers/admin/applications_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/groups/registry/repositories_controller.rb | 4 | ||||
-rw-r--r-- | app/controllers/projects/registry/repositories_controller.rb | 7 | ||||
-rw-r--r-- | app/models/user.rb | 3 | ||||
-rw-r--r-- | app/views/admin/applications/_form.html.haml | 8 | ||||
-rw-r--r-- | app/views/admin/applications/index.html.haml | 2 | ||||
-rw-r--r-- | app/views/admin/applications/show.html.haml | 6 | ||||
-rw-r--r-- | app/views/doorkeeper/applications/_form.html.haml | 6 | ||||
-rw-r--r-- | app/views/doorkeeper/applications/show.html.haml | 6 |
12 files changed, 43 insertions, 13 deletions
diff --git a/app/assets/javascripts/self_monitor/index.js b/app/assets/javascripts/self_monitor/index.js index 42c94e11989..7db87b4c627 100644 --- a/app/assets/javascripts/self_monitor/index.js +++ b/app/assets/javascripts/self_monitor/index.js @@ -4,15 +4,12 @@ import SelfMonitorForm from './components/self_monitor_form.vue'; export default () => { const el = document.querySelector('.js-self-monitoring-settings'); - let selfMonitorProjectCreated; if (el) { - selfMonitorProjectCreated = el.dataset.selfMonitoringProjectExists; // eslint-disable-next-line no-new new Vue({ el, store: store({ - projectEnabled: selfMonitorProjectCreated, ...el.dataset, }), render(createElement) { diff --git a/app/assets/javascripts/self_monitor/store/actions.js b/app/assets/javascripts/self_monitor/store/actions.js index f8430a9b136..10deec6921c 100644 --- a/app/assets/javascripts/self_monitor/store/actions.js +++ b/app/assets/javascripts/self_monitor/store/actions.js @@ -52,7 +52,7 @@ export const requestCreateProjectStatus = ({ dispatch, state }, jobId) => { }); }; -export const requestCreateProjectSuccess = ({ commit }, selfMonitorData) => { +export const requestCreateProjectSuccess = ({ commit, dispatch }, selfMonitorData) => { commit(types.SET_LOADING, false); commit(types.SET_PROJECT_URL, selfMonitorData.project_full_path); commit(types.SET_ALERT_CONTENT, { @@ -62,6 +62,7 @@ export const requestCreateProjectSuccess = ({ commit }, selfMonitorData) => { }); commit(types.SET_SHOW_ALERT, true); commit(types.SET_PROJECT_CREATED, true); + dispatch('setSelfMonitor', true); }; export const requestCreateProjectError = ({ commit }, error) => { diff --git a/app/assets/javascripts/self_monitor/store/state.js b/app/assets/javascripts/self_monitor/store/state.js index b8b4a4af614..a0ce88ff58c 100644 --- a/app/assets/javascripts/self_monitor/store/state.js +++ b/app/assets/javascripts/self_monitor/store/state.js @@ -1,8 +1,8 @@ import { parseBoolean } from '~/lib/utils/common_utils'; export default (initialState = {}) => ({ - projectEnabled: parseBoolean(initialState.projectEnabled) || false, - projectCreated: parseBoolean(initialState.selfMonitorProjectCreated) || false, + projectEnabled: parseBoolean(initialState.selfMonitoringProjectExists) || false, + projectCreated: parseBoolean(initialState.selfMonitoringProjectExists) || false, createProjectEndpoint: initialState.createSelfMonitoringProjectPath || '', deleteProjectEndpoint: initialState.deleteSelfMonitoringProjectPath || '', createProjectStatusEndpoint: initialState.statusCreateSelfMonitoringProjectPath || '', diff --git a/app/controllers/admin/applications_controller.rb b/app/controllers/admin/applications_controller.rb index 907b295870d..c017ecee054 100644 --- a/app/controllers/admin/applications_controller.rb +++ b/app/controllers/admin/applications_controller.rb @@ -55,6 +55,8 @@ class Admin::ApplicationsController < Admin::ApplicationController # Only allow a trusted parameter "white list" through. def application_params - params.require(:doorkeeper_application).permit(:name, :redirect_uri, :trusted, :scopes) + params + .require(:doorkeeper_application) + .permit(:name, :redirect_uri, :trusted, :scopes, :confidential) end end diff --git a/app/controllers/groups/registry/repositories_controller.rb b/app/controllers/groups/registry/repositories_controller.rb index cfddd8a3ba9..a4ef33ecc6a 100644 --- a/app/controllers/groups/registry/repositories_controller.rb +++ b/app/controllers/groups/registry/repositories_controller.rb @@ -7,13 +7,13 @@ module Groups before_action :feature_flag_group_container_registry_browser! def index - track_event(:list_repositories) - respond_to do |format| format.html format.json do @images = group.container_repositories.with_api_entity_associations + track_event(:list_repositories) + render json: ContainerRepositoriesSerializer .new(current_user: current_user) .represent_read_only(@images) diff --git a/app/controllers/projects/registry/repositories_controller.rb b/app/controllers/projects/registry/repositories_controller.rb index 9405fd526ae..5e933b3b51f 100644 --- a/app/controllers/projects/registry/repositories_controller.rb +++ b/app/controllers/projects/registry/repositories_controller.rb @@ -7,12 +7,13 @@ module Projects before_action :ensure_root_container_repository!, only: [:index] def index - @images = project.container_repositories - track_event(:list_repositories) - respond_to do |format| format.html format.json do + @images = project.container_repositories + + track_event(:list_repositories) + render json: ContainerRepositoriesSerializer .new(project: project, current_user: current_user) .represent(@images) diff --git a/app/models/user.rb b/app/models/user.rb index e86c0a1826d..bc113c72762 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -101,6 +101,7 @@ class User < ApplicationRecord # Groups has_many :members + has_one :max_access_level_membership, -> { select(:id, :user_id, :access_level).order(access_level: :desc).readonly }, class_name: 'Member' has_many :group_members, -> { where(requested_at: nil) }, source: 'GroupMember' has_many :groups, through: :group_members has_many :owned_groups, -> { where(members: { access_level: Gitlab::Access::OWNER }) }, through: :group_members, source: :group @@ -1027,7 +1028,7 @@ class User < ApplicationRecord end def highest_role - members.maximum(:access_level) || Gitlab::Access::NO_ACCESS + max_access_level_membership&.access_level || Gitlab::Access::NO_ACCESS end def accessible_deploy_keys diff --git a/app/views/admin/applications/_form.html.haml b/app/views/admin/applications/_form.html.haml index 21e84016c66..8338401bea5 100644 --- a/app/views/admin/applications/_form.html.haml +++ b/app/views/admin/applications/_form.html.haml @@ -30,6 +30,14 @@ %span.form-text.text-muted Trusted applications are automatically authorized on GitLab OAuth flow. + = content_tag :div, class: 'form-group row' do + .col-sm-2.col-form-label.pt-0 + = f.label :confidential + .col-sm-10 + = f.check_box :confidential + %span.form-text.text-muted + = _('The application will be used where the client secret can be kept confidential. Native mobile apps and Single Page Apps are considered non-confidential.') + .form-group.row .col-sm-2.col-form-label.pt-0 = f.label :scopes diff --git a/app/views/admin/applications/index.html.haml b/app/views/admin/applications/index.html.haml index 758d722cc63..c3861f335b8 100644 --- a/app/views/admin/applications/index.html.haml +++ b/app/views/admin/applications/index.html.haml @@ -12,6 +12,7 @@ %th Callback URL %th Clients %th Trusted + %th Confidential %th %th %tbody.oauth-applications @@ -21,6 +22,7 @@ %td= application.redirect_uri %td= @application_counts[application.id].to_i %td= application.trusted? ? 'Y': 'N' + %td= application.confidential? ? 'Y': 'N' %td= link_to 'Edit', edit_admin_application_path(application), class: 'btn btn-link' %td= render 'delete_form', application: application = paginate @applications, theme: 'gitlab' diff --git a/app/views/admin/applications/show.html.haml b/app/views/admin/applications/show.html.haml index aca9302aff7..146674a2fac 100644 --- a/app/views/admin/applications/show.html.haml +++ b/app/views/admin/applications/show.html.haml @@ -36,6 +36,12 @@ %td = @application.trusted? ? 'Y' : 'N' + %tr + %td + Confidential + %td + = @application.confidential? ? 'Y' : 'N' + = render "shared/tokens/scopes_list", token: @application .form-actions diff --git a/app/views/doorkeeper/applications/_form.html.haml b/app/views/doorkeeper/applications/_form.html.haml index 78904f550c7..79abe31a056 100644 --- a/app/views/doorkeeper/applications/_form.html.haml +++ b/app/views/doorkeeper/applications/_form.html.haml @@ -15,6 +15,12 @@ %span.form-text.text-muted = _('Use <code>%{native_redirect_uri}</code> for local tests').html_safe % { native_redirect_uri: Doorkeeper.configuration.native_redirect_uri } + .form-group.form-check + = f.check_box :confidential, class: 'form-check-input' + = f.label :confidential, class: 'label-bold form-check-label' + %span.form-text.text-muted + = _('The application will be used where the client secret can be kept confidential. Native mobile apps and Single Page Apps are considered non-confidential.') + .form-group = f.label :scopes, class: 'label-bold' = render 'shared/tokens/scopes_form', prefix: 'doorkeeper_application', token: application, scopes: @scopes diff --git a/app/views/doorkeeper/applications/show.html.haml b/app/views/doorkeeper/applications/show.html.haml index 8a1b7500abf..7b29269dbb1 100644 --- a/app/views/doorkeeper/applications/show.html.haml +++ b/app/views/doorkeeper/applications/show.html.haml @@ -34,6 +34,12 @@ %div %span.monospace= uri + %tr + %td + = _('Confidential') + %td + = @application.confidential? ? _('Yes') : _('No') + = render "shared/tokens/scopes_list", token: @application .form-actions |