Permalink
Browse files

Merged opf/openproject/v7.4.5 into opf/openproject-ce/stable/7

  • Loading branch information...
oliverguenther committed May 28, 2018
2 parents bba42cd + 67b26e7 commit e8f9a81d739d8a00bda7612cfcceaade5e92f00a
Showing with 1,326 additions and 132 deletions.
  1. +20 −20 Gemfile.lock
  2. +0 −1 README.md
  3. +18 −9 app/assets/javascripts/settings.js.erb
  4. +4 −0 app/assets/stylesheets/content/_attributes_key_value.sass
  5. +1 −0 app/assets/stylesheets/content/_calendar.sass
  6. +4 −2 app/cells/views/settings/text_setting/show.erb
  7. +13 −4 app/contracts/work_packages/base_contract.rb
  8. +6 −0 app/controllers/account_controller.rb
  9. +4 −1 app/controllers/concerns/authentication_stages.rb
  10. +104 −0 app/controllers/concerns/user_consent.rb
  11. +15 −1 app/helpers/accounts_helper.rb
  12. +6 −0 app/helpers/repositories_helper.rb
  13. +4 −0 app/helpers/settings_helper.rb
  14. +56 −0 app/helpers/user_consent_helper.rb
  15. +3 −12 app/models/permitted_params.rb
  16. +65 −0 app/models/permitted_params/allowed_settings.rb
  17. +39 −10 app/models/setting.rb
  18. +43 −0 app/models/setting/aliases.rb
  19. +18 −2 app/models/work_package/scheduling_rules.rb
  20. +7 −2 app/views/account/_register.html.erb
  21. +14 −0 app/views/account/_user_consent_check.html.erb
  22. +48 −0 app/views/account/consent.html.erb
  23. +1 −1 app/views/repositories/_revisions.html.erb
  24. +1 −1 app/views/repositories/revision.html.erb
  25. +8 −5 app/views/settings/_authentication.html.erb
  26. +39 −1 app/views/settings/_users.html.erb
  27. +9 −0 app/views/users/_consent.html.erb
  28. +4 −0 app/views/users/_form.html.erb
  29. +1 −1 app/views/users/_mail_notifications.html.erb
  30. +8 −12 app/views/wiki/new.html.erb
  31. +14 −0 config/initializers/authentication_stages.rb
  32. +2 −0 config/initializers/session_store.rb
  33. +23 −0 config/locales/en.yml
  34. +4 −0 config/routes.rb
  35. +15 −0 config/settings.yml
  36. +5 −0 db/migrate/20180524113516_add_consent_timestamp_to_user.rb
  37. +1 −4 frontend/app/components/wp-edit-form/work-package-changeset.ts
  38. +1 −0 lib/api/v3/relations/relation_collection_representer.rb
  39. +3 −2 lib/api/v3/work_packages/create_work_packages.rb
  40. +1 −0 lib/api/v3/work_packages/work_package_relations_api.rb
  41. +4 −1 lib/api/v3/work_packages/work_package_representer.rb
  42. +1 −1 lib/api/v3/work_packages/work_packages_api.rb
  43. +30 −0 lib/api/v3/work_packages/work_packages_shared_helpers.rb
  44. +5 −0 lib/open_project/authentication.rb
  45. +3 −1 lib/open_project/configuration.rb
  46. +1 −1 lib/open_project/version.rb
  47. +1 −0 lib/redmine/i18n.rb
  48. +200 −0 spec/features/auth/consent_auth_stage_spec.rb
  49. +1 −1 spec/lib/api/v3/relations/relation_representer_spec.rb
  50. +1 −1 spec/lib/api/v3/work_packages/work_package_representer_spec.rb
  51. +3 −7 spec/lib/redmine/i18n_spec.rb
  52. +42 −0 spec/models/permitted_params_spec.rb
  53. +202 −0 spec/requests/api/v3/work_packages/dependent_errors_spec.rb
  54. +23 −0 spec/services/work_packages/update_service_integration_spec.rb
  55. +1 −1 spec/support/authentication_helpers.rb
  56. +15 −2 spec/views/account/register.html.erb_spec.rb
  57. +25 −0 spec/views/settings/_authentication.html.erb_spec.rb
  58. +1 −1 vendored-plugins/openproject-auth_plugins/lib/open_project/auth_plugins/version.rb
  59. +1 −1 vendored-plugins/openproject-avatars/lib/open_project/avatars/version.rb
  60. +1 −1 vendored-plugins/openproject-backlogs/lib/open_project/backlogs/version.rb
  61. +4 −0 vendored-plugins/openproject-costs/app/models/labor_budget_item.rb
  62. +4 −0 vendored-plugins/openproject-costs/app/models/material_budget_item.rb
  63. +5 −1 vendored-plugins/openproject-costs/app/views/cost_objects/items/_labor_budget_item.html.erb
  64. +7 −2 vendored-plugins/openproject-costs/app/views/cost_objects/items/_material_budget_item.html.erb
  65. +1 −1 vendored-plugins/openproject-costs/app/views/cost_objects/subform/_material_budget_subform.html.erb
  66. +1 −1 vendored-plugins/openproject-costs/lib/open_project/costs/version.rb
  67. +1 −1 vendored-plugins/openproject-costs/spec/features/{ → budgets}/add_budget_spec.rb
  68. +77 −1 vendored-plugins/openproject-costs/spec/features/{ → budgets}/update_budget_spec.rb
  69. +1 −1 ...ored-plugins/openproject-costs/spec/lib/api/v3/work_packages/specific_work_package_schema_spec.rb
  70. +19 −1 vendored-plugins/openproject-costs/spec/support/pages/budget_form.rb
  71. +1 −1 vendored-plugins/openproject-documents/lib/open_project/documents/version.rb
  72. +1 −1 vendored-plugins/openproject-github_integration/lib/open_project/github_integration/version.rb
  73. +1 −1 vendored-plugins/openproject-global_roles/lib/open_project/global_roles/version.rb
  74. +1 −1 vendored-plugins/openproject-ldap_groups/lib/open_project/ldap_groups/version.rb
  75. +1 −1 vendored-plugins/openproject-meeting/lib/open_project/meeting/version.rb
  76. +1 −1 vendored-plugins/openproject-my_project_page/lib/open_project/my_project_page/version.rb
  77. +1 −1 vendored-plugins/openproject-openid_connect/lib/open_project/openid_connect/version.rb
  78. +1 −1 vendored-plugins/openproject-pdf_export/lib/open_project/pdf_export/version.rb
  79. +1 −1 vendored-plugins/openproject-reporting/lib/open_project/reporting/version.rb
  80. +1 −1 ...ugins/openproject-two_factor_authentication/lib/open_project/two_factor_authentication/version.rb
  81. +1 −1 vendored-plugins/openproject-webhooks/lib/open_project/webhooks/version.rb
  82. +1 −1 vendored-plugins/openproject-xls_export/lib/open_project/xls_export/version.rb
  83. +1 −1 vendored-plugins/reporting_engine/lib/reporting_engine/version.rb
@@ -113,73 +113,73 @@ GIT
PATH
remote: vendored-plugins/openproject-auth_plugins
specs:
openproject-auth_plugins (7.4.4)
openproject-auth_plugins (7.4.5)
omniauth (~> 1.0)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-avatars
specs:
openproject-avatars (7.4.4)
openproject-avatars (7.4.5)
fastimage (~> 2.1.0)
gravatar_image_tag (~> 1.2.0)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-backlogs
specs:
openproject-backlogs (7.4.4)
openproject-backlogs (7.4.5)
acts_as_silent_list (~> 3.0.0)
openproject-pdf_export (= 7.4.4)
openproject-pdf_export (= 7.4.5)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-costs
specs:
openproject-costs (7.4.4)
openproject-costs (7.4.5)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-documents
specs:
openproject-documents (7.4.4)
openproject-documents (7.4.5)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-github_integration
specs:
openproject-github_integration (7.4.4)
openproject-webhooks (~> 7.4.4)
openproject-github_integration (7.4.5)
openproject-webhooks (~> 7.4.5)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-global_roles
specs:
openproject-global_roles (7.4.4)
openproject-global_roles (7.4.5)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-ldap_groups
specs:
openproject-ldap_groups (7.4.4)
openproject-ldap_groups (7.4.5)
PATH
remote: vendored-plugins/openproject-meeting
specs:
openproject-meeting (7.4.4)
openproject-meeting (7.4.5)
icalendar (~> 2.3.0)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-my_project_page
specs:
openproject-my_project_page (7.4.4)
openproject-my_project_page (7.4.5)
rails (~> 5.0.0)
PATH
remote: vendored-plugins/openproject-openid_connect
specs:
openproject-openid_connect (7.4.4)
openproject-openid_connect (7.4.5)
lobby_boy (~> 0.1)
omniauth-openid_connect-providers (~> 0.1)
openproject-auth_plugins (~> 7.0)
@@ -188,44 +188,44 @@ PATH
PATH
remote: vendored-plugins/openproject-pdf_export
specs:
openproject-pdf_export (7.4.4)
openproject-pdf_export (7.4.5)
pdf-inspector (~> 1.3.0)
prawn (~> 2.2)
PATH
remote: vendored-plugins/openproject-reporting
specs:
openproject-reporting (7.4.4)
openproject-reporting (7.4.5)
jquery-tablesorter (~> 1.22.3)
openproject-costs (= 7.4.4)
openproject-costs (= 7.4.5)
rails (~> 5.0.0)
reporting_engine (>= 1.1.0)
PATH
remote: vendored-plugins/openproject-two_factor_authentication
specs:
openproject-two_factor_authentication (7.4.4)
openproject-two_factor_authentication (7.4.5)
messagebird-rest (~> 1.3.2)
rails (~> 5)
rotp (~> 3.3)
PATH
remote: vendored-plugins/openproject-webhooks
specs:
openproject-webhooks (7.4.4)
openproject-webhooks (7.4.5)
rails (~> 5.0)
PATH
remote: vendored-plugins/openproject-xls_export
specs:
openproject-xls_export (7.4.4)
openproject-xls_export (7.4.5)
rails (~> 5.0.0)
spreadsheet (~> 0.8.9)
PATH
remote: vendored-plugins/reporting_engine
specs:
reporting_engine (7.4.4)
reporting_engine (7.4.5)
json
rails (~> 5.0.0)
@@ -1,6 +1,5 @@
# OpenProject
[<img src="https://travis-ci.org/opf/openproject.svg?branch=dev" alt="Build Status" />](https://travis-ci.org/opf/openproject)
[<img src="https://gemnasium.com/opf/openproject.png" alt="Dependency Status" />](https://gemnasium.com/opf/openproject)
[![Code Climate](https://codeclimate.com/github/opf/openproject/badges/gpa.svg)](https://codeclimate.com/github/opf/openproject)
OpenProject is a web-based project management software. Its key features are:
@@ -54,15 +54,24 @@ See doc/COPYRIGHT.rdoc for more details.
});
/* Javascript for Settings::TextSettingCell */
$(document).ready(function() {
$(".lang-select-switch").change(function() {
var self = $(this);
var id = self.attr("id");
var lang = self.val();
$("." + id).hide();
$("#" + id + "-" + lang).show();
});
$(".lang-select-switch").change(function() {
var self = $(this);
var id = self.attr("id");
var lang = self.val();
$("." + id).hide();
$("#" + id + "-" + lang).show();
});
$('.admin-settings--form').submit(function() {
/* Update consent time if consent required */
if ($('#settings_consent_required').is(':checked') && $('#toggle_consent_time').is(':checked')) {
$('#settings_consent_time')
.val(new Date().toISOString())
.prop('disabled', false);
}
return true;
});
/** Toggle notification settings fields */
@@ -30,6 +30,10 @@
@include grid-block
@include grid-layout(2)
@include grid-visible-overflow
// Overriding position: relative defined by grid-block
// which seems to collide (chrome 66) with the column-count
// defined conditionally on the element as well.
position: static
font-size: 0.875rem
line-height: 1.6
@@ -83,6 +83,7 @@ table.cal
.issue
vertical-align: middle
z-index: 1
p.legend.cal
margin-bottom: 0
@@ -1,6 +1,8 @@
<%# The javscript for this cell is included in `settings.js.erb`. %>
<div class="form--field -vertical">
<div class="form--field">
<%# Empty label for styling only %>
<%= styled_label_tag "lang", '' %>
<div class="form--field-container">
<%=
styled_select_tag(
@@ -19,7 +21,7 @@
<%= "style=\"display:none\"" unless lang == current_language.to_s %>
class="lang-select lang-for-<%= name %>"
>
<div class="form--field -vertical">
<div class="form--field">
<%= styled_label_tag "settings[#{name}][#{lang}]", t("setting_#{name}") %>
<div class="form--field-container">
<%=
@@ -269,10 +269,19 @@ def status_transition_exists?
end
def invalid_relations_with_new_hierarchy
Relation
.from_parent_to_self_and_descendants(model)
.or(Relation.from_self_and_descendants_to_ancestors(model))
.direct
query = Relation.from_parent_to_self_and_descendants(model)
.or(Relation.from_self_and_descendants_to_ancestors(model))
.direct
# Ignore the immediate relation from the old parent to the model
# since that will still exist before saving.
old_parent_id = model.parent_id_was
if old_parent_id.present?
query.where.not(hierarchy: 1, from_id: old_parent_id, to_id: model.id)
else
query
end
end
end
end
@@ -33,6 +33,7 @@ class AccountController < ApplicationController
include Concerns::OmniauthLogin
include Concerns::RedirectAfterLogin
include Concerns::AuthenticationStages
include Concerns::UserConsent
# prevents login action to be filtered by check_if_login_required application scope filter
skip_before_action :check_if_login_required
@@ -320,6 +321,11 @@ def self_registration!
@user.register
end
# Set consent if received from registration form
if consent_param?
@user.consented_at = DateTime.now
end
if session[:auth_source_registration]
# on-the-fly registration via omniauth or via auth source
if pending_omniauth_registration?
@@ -60,7 +60,10 @@ def init_authentication_stages(after_activation:)
session[:stage_secrets] = session[:authentication_stages]
.map { |ident| [ident, stage_secret(ident)] }
.to_h
session[:back_url] = back_url
# Remember back_url from params since we're redirecting
# but don't use the referer
session[:back_url] = params[:back_url]
stages
end
@@ -0,0 +1,104 @@
#-- copyright
# OpenProject is a project management system.
# Copyright (C) 2012-2017 the OpenProject Foundation (OPF)
#
# 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-2017 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 doc/COPYRIGHT.rdoc for more details.
#++
##
# Intended to be used by the AccountController to implement the user consent
# check.
module Concerns::UserConsent
include ::UserConsentHelper
def consent
if consent_required?
render 'account/consent', locals: { consenting_user: consenting_user }
else
consent_finished
end
end
def confirm_consent
user = consenting_user
if user.present? && consent_param?
approve_consent!(user)
else
reject_consent!
end
end
def consent_required?
# Ensure consent is enabled and a text is provided
return false unless user_consent_required?
# Require the user to consent if he hasn't already
consent_expired?
end
def decline_consent
message = I18n.t('consent.decline_warning_message') + "\n"
message <<
if Setting.consent_decline_mail
I18n.t('consent.contact_this_mail_address', mail_address: Setting.consent_decline_mail)
else
I18n.t('consent.contact_your_administrator')
end
flash[:error] = message
redirect_to authentication_stage_failure_path :consent
end
def consent_expired?
consented_at = consenting_user.try(:consented_at)
# Always if the user has not consented
return true if consented_at.blank?
# Did not expire if no consent_time set, but user has consented at some point
return false if Setting.consent_time.blank?
# Otherwise, expires when consent_time is newer than last consented_at
consented_at < Setting.consent_time
end
def consenting_user
User.find_by id: session[:authenticated_user_id]
end
def approve_consent!(user)
user.update_column(:consented_at, DateTime.now)
consent_finished
end
def consent_finished
redirect_to authentication_stage_complete_path(:consent)
end
def reject_consent!
flash[:error] = I18n.t('consent.failure_message')
redirect_to authentication_stage_failure_path :consent
end
end
Oops, something went wrong.

0 comments on commit e8f9a81

Please sign in to comment.