diff --git a/app/cells/placeholder_users/row_cell.rb b/app/cells/placeholder_users/row_cell.rb index 6062efe3b2..4cecc448d6 100644 --- a/app/cells/placeholder_users/row_cell.rb +++ b/app/cells/placeholder_users/row_cell.rb @@ -32,6 +32,8 @@ module PlaceholderUsers class RowCell < ::RowCell include AvatarHelper include UsersHelper + include PlaceholderUsersHelper + include TooltipHelper def placeholder_user model @@ -46,15 +48,12 @@ module PlaceholderUsers end def delete_link - if PlaceholderUsers::DeleteContract.deletion_allowed?(placeholder_user, - User.current, - table.user_allowed_service) - + if can_delete_placeholder_user?(placeholder_user, User.current) link_to deletion_info_placeholder_user_path(placeholder_user) do - "".html_safe + tooltip_tag I18n.t('placeholder_users.delete_tooltip'), icon: 'icon-delete' end else - "".html_safe + tooltip_tag I18n.t('placeholder_users.right_to_manage_members_missing'), icon: 'icon-help2' end end diff --git a/app/controllers/placeholder_users_controller.rb b/app/controllers/placeholder_users_controller.rb index fcce9e2800..45d8cb6627 100644 --- a/app/controllers/placeholder_users_controller.rb +++ b/app/controllers/placeholder_users_controller.rb @@ -41,6 +41,9 @@ class PlaceholderUsersController < ApplicationController deletion_info destroy] + before_action :authorize_deletion, only: %i[deletion_info destroy] + + def index @placeholder_users = PlaceholderUsers::PlaceholderUserFilterCell.query params @@ -149,6 +152,12 @@ class PlaceholderUsersController < ApplicationController protected + def authorize_deletion + unless helpers.can_delete_placeholder_user?(@placeholder_user, current_user) + render_403 message: I18n.t('placeholder_users.right_to_manage_members_missing') + end + end + def default_breadcrumb if action_name == 'index' t('label_placeholder_user_plural') diff --git a/app/helpers/placeholder_users_helper.rb b/app/helpers/placeholder_users_helper.rb new file mode 100644 index 0000000000..ff52f476fa --- /dev/null +++ b/app/helpers/placeholder_users_helper.rb @@ -0,0 +1,39 @@ +#-- encoding: UTF-8 + +#-- copyright +# OpenProject is an open source project management software. +# Copyright (C) 2012-2021 the OpenProject GmbH +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# See docs/COPYRIGHT.rdoc for more details. +#++ + +module PlaceholderUsersHelper + ## + # Determine whether the given actor can delete the placeholder user + def can_delete_placeholder_user?(placeholder, actor = User.current) + PlaceholderUsers::DeleteContract.deletion_allowed? placeholder, + actor, + Authorization::UserAllowedService.new(actor) + end +end diff --git a/app/helpers/tooltip_helper.rb b/app/helpers/tooltip_helper.rb new file mode 100644 index 0000000000..ea35a4f84f --- /dev/null +++ b/app/helpers/tooltip_helper.rb @@ -0,0 +1,48 @@ +#-- encoding: UTF-8 + +#-- copyright +# OpenProject is an open source project management software. +# Copyright (C) 2012-2021 the OpenProject GmbH +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License version 3. +# +# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +# Copyright (C) 2006-2013 Jean-Philippe Lang +# Copyright (C) 2010-2013 the ChiliProject Team +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +# See docs/COPYRIGHT.rdoc for more details. +#++ + +module TooltipHelper + include OpenProject::FormTagHelper + + ## + # Render a tooltip span + # + # @param text [string] Content of the tooltip + # @param placement [string] placement (top, left, right, bottom) + # @param span_classes [string] Additional classes on the span + # @param icon [string] icon class + def tooltip_tag(text, placement: 'left', icon: 'icon-help', span_classes: nil) + content_tag :span, + class: "tooltip--#{placement} #{span_classes}", + data: { tooltip: text } do + op_icon "icon #{icon}" + end + end +end diff --git a/app/views/placeholder_users/_toolbar.html.erb b/app/views/placeholder_users/_toolbar.html.erb index 02a004aa18..de88059846 100644 --- a/app/views/placeholder_users/_toolbar.html.erb +++ b/app/views/placeholder_users/_toolbar.html.erb @@ -34,12 +34,6 @@ See docs/COPYRIGHT.rdoc for more details. <%= t(:label_profile) %> <% end %> -
  • - <%= link_to deletion_info_placeholder_user_path(@placeholder_user), - class: 'button' do %> - <%= op_icon('button--icon icon-delete') %> - <%= t(:button_delete) %> - <% end %> -
  • + <%= render partial: 'placeholder_users/toolbar_delete' %> <% end %> <% end %> diff --git a/app/views/placeholder_users/_toolbar_delete.html.erb b/app/views/placeholder_users/_toolbar_delete.html.erb new file mode 100644 index 0000000000..93f03637f6 --- /dev/null +++ b/app/views/placeholder_users/_toolbar_delete.html.erb @@ -0,0 +1,48 @@ +<%#-- copyright +OpenProject is an open source project management software. +Copyright (C) 2012-2021 the OpenProject GmbH + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License version 3. + +OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows: +Copyright (C) 2006-2013 Jean-Philippe Lang +Copyright (C) 2010-2013 the ChiliProject Team + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +See docs/COPYRIGHT.rdoc for more details. + +++#%> + +<% if can_delete_placeholder_user?(@placeholder_user) %> +
  • + <%= link_to deletion_info_placeholder_user_path(@placeholder_user), + class: 'button' do %> + <%= op_icon('button--icon icon-delete') %> + <%= t(:button_delete) %> + <% end %> +
  • +<% else %> +
  • + <%= content_tag :span, title: I18n.t('placeholder_users.right_to_manage_members_missing') do %> + <%= link_to '#', + class: 'button -disabled' do %> + <%= op_icon('button--icon icon-delete') %> + <%= t(:button_delete) %> + <% end %> + <% end %> +
  • +<% end %> \ No newline at end of file diff --git a/app/views/placeholder_users/show.html.erb b/app/views/placeholder_users/show.html.erb index 93a1207cb8..091ccab047 100644 --- a/app/views/placeholder_users/show.html.erb +++ b/app/views/placeholder_users/show.html.erb @@ -39,13 +39,7 @@ See docs/COPYRIGHT.rdoc for more details. <%= t(:button_edit) %> <% end %> -
  • - <%= link_to deletion_info_placeholder_user_path(@placeholder_user), - class: 'button' do %> - <%= op_icon('button--icon icon-delete') %> - <%= t(:button_delete) %> - <% end %> -
  • + <%= render partial: 'placeholder_users/toolbar_delete' %> <% end %> <% end %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ccf0086b13..311319175e 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -2931,6 +2931,9 @@ en: resources: schema: 'Schema' + undisclosed: + parent: Undisclosed - The selected parent is invisible because of lacking permissions. + doorkeeper: pre_authorization: status: 'Pre-authorization' diff --git a/docs/api/apiv3/basic-objects.apib b/docs/api/apiv3/basic-objects.apib index c6511254fa..2b4b8794fc 100644 --- a/docs/api/apiv3/basic-objects.apib +++ b/docs/api/apiv3/basic-objects.apib @@ -42,6 +42,15 @@ in its strings (e.g. `{ "href": "/api/v3/examples/{example_id}" }`). Note: When writing links (e.g. during a `PATCH` operation) only changes to `href` are accepted. Changes to all other properties will be **silently ignored**. +For resources invisible to the client (e.g. because of missing permissions), a link will contain +the uri `urn:openproject-org:api:v3:undisclosed` instead of a url. This indicates the existence of a value +without revealing the actual value. An example for this is the parent project. A project resource which itself might be +visible to the client can have a reference to a parent project invisible to the same client. Revealing the existence of +a parent over hiding has the benefit of allowing the client to make an informed decision of whether to keep the existing reference +or updating it. Sending ‘{ "href": "urn:openproject-org:api:v3:undisclosed" }` for a resource will have the effect of keeping the +original value. This is especially beneficial if the client creates and updates resources based on the payload object provided +as part of a form as is recommended when interacting with the API. + # Errors In case of an error, the API will respond with an appropriate HTTP status code. diff --git a/docs/api/apiv3/endpoints/projects.apib b/docs/api/apiv3/endpoints/projects.apib index ec19eaedd6..b64596b78f 100644 --- a/docs/api/apiv3/endpoints/projects.apib +++ b/docs/api/apiv3/endpoints/projects.apib @@ -29,6 +29,10 @@ As containers, they also control behaviour of the elements within them. One of t Depending on custom fields defined for projects, additional links might exist. +Note, that the parent link may contain the "undisclosed uri" `urn:openproject-org:api:v3:undisclosed` in case a +parent project is defined but the client lacks permission to see it. See the +[general introduction into links' properties](/api/basic-objects/#header-local-properties-1) for more information. + ## Local Properties | Property | Description | Type | Constraints | Supported operations | diff --git a/docs/getting-started/projects/README.md b/docs/getting-started/projects/README.md index 8b67265e21..7aedc42428 100644 --- a/docs/getting-started/projects/README.md +++ b/docs/getting-started/projects/README.md @@ -61,6 +61,10 @@ Also, you can click the green button **+ Project** directly on the system's home ![Create-project-home-screen](Create-project-home-screen.png) +Alternatively, you can use the green **+ button** in the header menu to create a new project. + +![create-project-header](create-project-header.png) + - You can either create a completely new project, create a subproject of an existing project or create a (sub)project from a template. For the latter option, choose a [template](../../user-guide/projects/#create-a-project-template) using the drop-down menu. - Enter a **name** for your project and click the blue **Create** button. - The **Advanced Settings** allow for further configuration, e.g. description, URL, etc. diff --git a/docs/getting-started/projects/create-project-header.png b/docs/getting-started/projects/create-project-header.png new file mode 100644 index 0000000000..51c4f1f205 Binary files /dev/null and b/docs/getting-started/projects/create-project-header.png differ diff --git a/docs/getting-started/work-packages-introduction/README.md b/docs/getting-started/work-packages-introduction/README.md index b6e4fc6c87..107088911f 100644 --- a/docs/getting-started/work-packages-introduction/README.md +++ b/docs/getting-started/work-packages-introduction/README.md @@ -48,6 +48,16 @@ The work package will the be displayed in the list view: ![list-view-work-package](1569611758166.png) +Another option to create a work package is to do it from the header menu. The [work package types](../../user-guide/projects/proejct-settings/work-package-types/#work-pacakge-types) that are activated, will be shown and you can select the relevant work package type to be created. + +![create-work-package-header](create-work-package-header.png) + +Once you click on the work package type that you want to create, the work package detail view opens and you have to **select the project** that you want to create the work package for. + +![create-work-package-define-project](create-work-package-define-project.png) + +Then you follow the same steps as mentioned above to fill in the your work package attributes and save it. + ## Open and edit a work package To open and edit an existing work package from the list, select the work package in the list which you want to edit and click on the **open details view** icon in the work package list or on top of the list to open the split screen view. Other ways to open it would be to double-click on the work package or to click on the work package ID. diff --git a/docs/getting-started/work-packages-introduction/create-work-package-define-project.png b/docs/getting-started/work-packages-introduction/create-work-package-define-project.png new file mode 100644 index 0000000000..817f79ba08 Binary files /dev/null and b/docs/getting-started/work-packages-introduction/create-work-package-define-project.png differ diff --git a/docs/getting-started/work-packages-introduction/create-work-package-header.png b/docs/getting-started/work-packages-introduction/create-work-package-header.png new file mode 100644 index 0000000000..1210790086 Binary files /dev/null and b/docs/getting-started/work-packages-introduction/create-work-package-header.png differ diff --git a/docs/system-admin-guide/github-integration/Github integration PR overview.png b/docs/system-admin-guide/github-integration/Github integration PR overview.png new file mode 100644 index 0000000000..3c7aeaa60d Binary files /dev/null and b/docs/system-admin-guide/github-integration/Github integration PR overview.png differ diff --git a/docs/system-admin-guide/github-integration/Github integration actions.png b/docs/system-admin-guide/github-integration/Github integration actions.png new file mode 100644 index 0000000000..f388b02933 Binary files /dev/null and b/docs/system-admin-guide/github-integration/Github integration actions.png differ diff --git a/docs/system-admin-guide/github-integration/Github integration create branch.png b/docs/system-admin-guide/github-integration/Github integration create branch.png new file mode 100644 index 0000000000..dba19588fa Binary files /dev/null and b/docs/system-admin-guide/github-integration/Github integration create branch.png differ diff --git a/docs/system-admin-guide/github-integration/Github integration tab.png b/docs/system-admin-guide/github-integration/Github integration tab.png new file mode 100644 index 0000000000..6080fc1651 Binary files /dev/null and b/docs/system-admin-guide/github-integration/Github integration tab.png differ diff --git a/docs/system-admin-guide/github-integration/Github-module.png b/docs/system-admin-guide/github-integration/Github-module.png new file mode 100644 index 0000000000..f0cb895eaf Binary files /dev/null and b/docs/system-admin-guide/github-integration/Github-module.png differ diff --git a/docs/system-admin-guide/github-integration/README.md b/docs/system-admin-guide/github-integration/README.md index 19af386db2..fe3c415e71 100644 --- a/docs/system-admin-guide/github-integration/README.md +++ b/docs/system-admin-guide/github-integration/README.md @@ -9,14 +9,13 @@ keywords: github integration # GitHub integration OpenProject offers an integration for GitHub pull requests. -You create a pull request in GitHub and link to an OpenProject work package. +You create a pull request in GitHub and link it to an OpenProject work package. ![New pull request linking to an OpenProject work package](github-pr-workpackage-reference.png) Rather than inserting a link to the work package you can also reference it just by adding "OP#87" to the pull request's description where 87 is the ID of the work package. -OpenProject will add comments to work package about the pull request when -the pull request is +OpenProject will add comments to work packages about the pull request when the pull request is * first referenced (usually when opened) * merged @@ -32,6 +31,29 @@ You will have to configure both OpenProject and GitHub for the integration to wo ### OpenProject +In *Project settings* and *Modules* you will need to activate the GitHub module. + +![Github-module](Github-module.png) + +Then you will have a GitHub tab appearing in your work package view where you will see all information pulling through from GitHub. + +![Github integration tab](Github integration tab.png) + +In your OpenProject work package, the new GitHub integration supports you to create a branch straight from the work package and consequently the matching pull request. + + +![Github integration create branch](Github integration create branch.png) + +If you already have an existing pull request in GitHub, you can link it using the code OP#5999 (5999 being the ID of the work package) in the GitHub pull request description. + + + +![Github integration PR overview](Github integration PR overview.png) + + + +![Github integration actions](Github integration actions.png) + First you will need to create a user in OpenProject that will make the comments. The user will have to be added to each project with a role that allows them to comment on work packages. diff --git a/frontend/karma.conf.js b/frontend/karma.conf.js index 45fddf0352..b256543363 100644 --- a/frontend/karma.conf.js +++ b/frontend/karma.conf.js @@ -49,6 +49,10 @@ module.exports = function (config) { ChromeHeadlessNoSandbox: { base: 'ChromeHeadless', flags: ['--no-sandbox'] + }, + ChromeWithDebug: { + base: 'Chrome', + flags: ['--no-sandbox', '--debug', '--auto-open-devtools-for-tabs'] } }, singleRun: false diff --git a/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.html b/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.html index 069daf31fb..e45fe8c5ad 100644 --- a/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.html +++ b/frontend/src/app/components/modals/wp-destroy-modal/wp-destroy.modal.html @@ -1,5 +1,5 @@
    @@ -50,7 +50,7 @@
    -