diff --git a/Gemfile b/Gemfile index 2e3ec8ba07..9e19b81431 100644 --- a/Gemfile +++ b/Gemfile @@ -26,13 +26,13 @@ gem 'jwt' gem 'mini_magick', '>= 4.9.5' gem 'omniauth', '~> 2.1.2' gem 'omniauth_openid_connect', '>= 0.6.1' -gem 'omniauth-rails_csrf_protection', '~> 1.0.1' +gem 'omniauth-rails_csrf_protection', '~> 1.0.2' gem 'pagy', '~> 6.0', '>= 6.0.0' gem 'pg' gem 'puma', '~> 5.6' -gem 'rails', '~> 7.1.3' +gem 'rails', '~> 7.1.3', '>= 7.1.3.3' gem 'redis', '~> 4.0' -gem 'sprockets-rails' +gem 'sprockets-rails', '>= 3.5.0' gem 'tzinfo-data', platforms: %i[mingw mswin x64_mingw jruby] group :development, :test do diff --git a/Gemfile.lock b/Gemfile.lock index f5ea4a2a32..86bfec749b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,35 +1,35 @@ GEM remote: https://rubygems.org/ specs: - actioncable (7.1.3.1) - actionpack (= 7.1.3.1) - activesupport (= 7.1.3.1) + actioncable (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) nio4r (~> 2.0) websocket-driver (>= 0.6.1) zeitwerk (~> 2.6) - actionmailbox (7.1.3.1) - actionpack (= 7.1.3.1) - activejob (= 7.1.3.1) - activerecord (= 7.1.3.1) - activestorage (= 7.1.3.1) - activesupport (= 7.1.3.1) + actionmailbox (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (>= 2.7.1) net-imap net-pop net-smtp - actionmailer (7.1.3.1) - actionpack (= 7.1.3.1) - actionview (= 7.1.3.1) - activejob (= 7.1.3.1) - activesupport (= 7.1.3.1) + actionmailer (7.1.3.4) + actionpack (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activesupport (= 7.1.3.4) mail (~> 2.5, >= 2.5.4) net-imap net-pop net-smtp rails-dom-testing (~> 2.2) - actionpack (7.1.3.1) - actionview (= 7.1.3.1) - activesupport (= 7.1.3.1) + actionpack (7.1.3.4) + actionview (= 7.1.3.4) + activesupport (= 7.1.3.4) nokogiri (>= 1.8.5) racc rack (>= 2.2.4) @@ -37,15 +37,15 @@ GEM rack-test (>= 0.6.3) rails-dom-testing (~> 2.2) rails-html-sanitizer (~> 1.6) - actiontext (7.1.3.1) - actionpack (= 7.1.3.1) - activerecord (= 7.1.3.1) - activestorage (= 7.1.3.1) - activesupport (= 7.1.3.1) + actiontext (7.1.3.4) + actionpack (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.6.0) nokogiri (>= 1.8.5) - actionview (7.1.3.1) - activesupport (= 7.1.3.1) + actionview (7.1.3.4) + activesupport (= 7.1.3.4) builder (~> 3.1) erubi (~> 1.11) rails-dom-testing (~> 2.2) @@ -60,22 +60,22 @@ GEM activemodel (>= 5.2.0) activestorage (>= 5.2.0) activesupport (>= 5.2.0) - activejob (7.1.3.1) - activesupport (= 7.1.3.1) + activejob (7.1.3.4) + activesupport (= 7.1.3.4) globalid (>= 0.3.6) - activemodel (7.1.3.1) - activesupport (= 7.1.3.1) - activerecord (7.1.3.1) - activemodel (= 7.1.3.1) - activesupport (= 7.1.3.1) + activemodel (7.1.3.4) + activesupport (= 7.1.3.4) + activerecord (7.1.3.4) + activemodel (= 7.1.3.4) + activesupport (= 7.1.3.4) timeout (>= 0.4.0) - activestorage (7.1.3.1) - actionpack (= 7.1.3.1) - activejob (= 7.1.3.1) - activerecord (= 7.1.3.1) - activesupport (= 7.1.3.1) + activestorage (7.1.3.4) + actionpack (= 7.1.3.4) + activejob (= 7.1.3.4) + activerecord (= 7.1.3.4) + activesupport (= 7.1.3.4) marcel (~> 1.0) - activesupport (7.1.3.1) + activesupport (7.1.3.4) base64 bigdecimal concurrent-ruby (~> 1.0, >= 1.0.2) @@ -116,12 +116,12 @@ GEM rack (>= 1.6.11) rubyzip (>= 1.3.0) xml-simple (~> 1.1) - bigdecimal (3.1.7) + bigdecimal (3.1.8) bindata (2.5.0) bindex (0.8.1) bootsnap (1.16.0) msgpack (~> 1.2) - builder (3.2.4) + builder (3.3.0) capybara (3.38.0) addressable matrix @@ -135,7 +135,7 @@ GEM activesupport childprocess (4.1.0) clamby (1.6.10) - concurrent-ruby (1.2.3) + concurrent-ruby (1.3.3) connection_pool (2.4.1) crack (0.4.5) rexml @@ -215,15 +215,15 @@ GEM json hiredis (0.6.3) httpclient (2.8.3) - i18n (1.14.4) + i18n (1.14.5) concurrent-ruby (~> 1.0) i18n-language-mapping (0.1.3.1) image_processing (1.12.2) mini_magick (>= 4.9.5, < 5) ruby-vips (>= 2.0.17, < 3) io-console (0.7.2) - irb (1.12.0) - rdoc + irb (1.13.1) + rdoc (>= 4.0.0) reline (>= 0.4.2) jbuilder (2.11.5) actionview (>= 5.0.0) @@ -255,38 +255,38 @@ GEM net-imap net-pop net-smtp - marcel (1.0.2) + marcel (1.0.4) matrix (0.4.2) memoist (0.16.2) mini_magick (4.12.0) mini_mime (1.1.5) - mini_portile2 (2.8.6) - minitest (5.22.3) + mini_portile2 (2.8.7) + minitest (5.23.1) msgpack (1.6.0) multi_json (1.15.0) mutex_m (0.2.0) net-http (0.4.1) uri - net-imap (0.4.10) + net-imap (0.4.12) date net-protocol net-pop (0.1.2) net-protocol net-protocol (0.2.2) timeout - net-smtp (0.4.0.1) + net-smtp (0.5.0) net-protocol - nio4r (2.7.0) - nokogiri (1.16.4) + nio4r (2.7.3) + nokogiri (1.16.5) mini_portile2 (~> 2.8.2) racc (~> 1.4) - nokogiri (1.16.4-x86_64-linux) + nokogiri (1.16.5-x86_64-linux) racc (~> 1.4) omniauth (2.1.2) hashie (>= 3.4.6) rack (>= 2.2.3) rack-protection - omniauth-rails_csrf_protection (1.0.1) + omniauth-rails_csrf_protection (1.0.2) actionpack (>= 4.2) omniauth (~> 2.0) omniauth_openid_connect (0.7.1) @@ -317,7 +317,7 @@ GEM public_suffix (5.0.3) puma (5.6.8) nio4r (~> 2.0) - racc (1.7.3) + racc (1.8.0) rack (2.2.9) rack-oauth2 (2.2.0) activesupport @@ -336,20 +336,20 @@ GEM rackup (1.0.0) rack (< 3) webrick - rails (7.1.3.1) - actioncable (= 7.1.3.1) - actionmailbox (= 7.1.3.1) - actionmailer (= 7.1.3.1) - actionpack (= 7.1.3.1) - actiontext (= 7.1.3.1) - actionview (= 7.1.3.1) - activejob (= 7.1.3.1) - activemodel (= 7.1.3.1) - activerecord (= 7.1.3.1) - activestorage (= 7.1.3.1) - activesupport (= 7.1.3.1) + rails (7.1.3.4) + actioncable (= 7.1.3.4) + actionmailbox (= 7.1.3.4) + actionmailer (= 7.1.3.4) + actionpack (= 7.1.3.4) + actiontext (= 7.1.3.4) + actionview (= 7.1.3.4) + activejob (= 7.1.3.4) + activemodel (= 7.1.3.4) + activerecord (= 7.1.3.4) + activestorage (= 7.1.3.4) + activesupport (= 7.1.3.4) bundler (>= 1.15.0) - railties (= 7.1.3.1) + railties (= 7.1.3.4) rails-dom-testing (2.2.0) activesupport (>= 5.0.0) minitest @@ -357,9 +357,9 @@ GEM rails-html-sanitizer (1.6.0) loofah (~> 2.21) nokogiri (~> 1.14) - railties (7.1.3.1) - actionpack (= 7.1.3.1) - activesupport (= 7.1.3.1) + railties (7.1.3.4) + actionpack (= 7.1.3.4) + activesupport (= 7.1.3.4) irb rackup (>= 1.0.0) rake (>= 12.2) @@ -367,11 +367,11 @@ GEM zeitwerk (~> 2.6) rainbow (3.1.1) rake (13.2.1) - rdoc (6.6.3.1) + rdoc (6.7.0) psych (>= 4.0.0) redis (4.8.0) regexp_parser (2.8.1) - reline (0.5.4) + reline (0.5.9) io-console (~> 0.5) remote_syslog_logger (1.0.4) syslog_protocol @@ -442,12 +442,12 @@ GEM faraday (>= 0.17.5, < 3.a) jwt (>= 1.5, < 3.0) multi_json (~> 1.10) - sprockets (4.2.0) + sprockets (4.2.1) concurrent-ruby (~> 1.0) rack (>= 2.2.4, < 4) - sprockets-rails (3.4.2) - actionpack (>= 5.2) - activesupport (>= 5.2) + sprockets-rails (3.5.0) + actionpack (>= 6.1) + activesupport (>= 6.1) sprockets (>= 3.0.0) stringio (3.1.0) swd (2.0.2) @@ -496,7 +496,7 @@ GEM rexml xpath (3.2.0) nokogiri (~> 1.8) - zeitwerk (2.6.13) + zeitwerk (2.6.15) PLATFORMS ruby @@ -529,12 +529,12 @@ DEPENDENCIES lograge (~> 0.14.0) mini_magick (>= 4.9.5) omniauth (~> 2.1.2) - omniauth-rails_csrf_protection (~> 1.0.1) + omniauth-rails_csrf_protection (~> 1.0.2) omniauth_openid_connect (>= 0.6.1) pagy (~> 6.0, >= 6.0.0) pg puma (~> 5.6) - rails (~> 7.1.3) + rails (~> 7.1.3, >= 7.1.3.3) redis (~> 4.0) remote_syslog_logger rspec-rails (>= 6.0.4) @@ -546,7 +546,7 @@ DEPENDENCIES rubocop-rspec (~> 2.9.0) selenium-webdriver shoulda-matchers (~> 5.0) - sprockets-rails + sprockets-rails (>= 3.5.0) tzinfo-data web-console (>= 4.2.1) webdrivers diff --git a/app/assets/locales/el.json b/app/assets/locales/el.json index 28d6b3c5a4..6ea43f0b92 100644 --- a/app/assets/locales/el.json +++ b/app/assets/locales/el.json @@ -14,6 +14,7 @@ "report": "Αναφορά", "share": "Κοινή χρήση", "cancel": "Ακύρωση", + "reset": "Επαναφορά", "close": "Κλείσιμο", "delete": "Διαγραφή", "copy": "Αντιγραφή συνδέσμου εγγραφής", @@ -229,7 +230,8 @@ "empty_invited_users_subtext": "Μόλις η κατάσταση του χρήστη αλλάξει σε προσκεκλημένος, θα εμφανιστεί εδώ.", "invited": { "time_sent": "Ώρα αποστολής", - "valid": "Έγκυρο" + "valid": "Έγκυρο", + "revoke": "Ανάκληση" } }, "server_rooms": { @@ -429,7 +431,8 @@ "role_permission_updated": "Τα δικαιώματα του ρόλου ενημερώθηκαν." }, "invitations": { - "invitation_sent": "Η πρόσκληση στάλθηκε" + "invitation_sent": "Η πρόσκληση στάλθηκε", + "invitation_revoked": "Έχει γίνει ανάκληση μιας πρόσκλησης" } }, "error": { diff --git a/app/assets/locales/en.json b/app/assets/locales/en.json index e1505b24a6..9c3e311ce7 100644 --- a/app/assets/locales/en.json +++ b/app/assets/locales/en.json @@ -14,6 +14,7 @@ "report": "Report", "share": "Share", "cancel": "Cancel", + "reset": "Reset", "close": "Close", "delete": "Delete", "copy": "Copy Join Link", @@ -237,7 +238,8 @@ "empty_invited_users_subtext": "When a user's status gets changed to invited, they will appear here.", "invited": { "time_sent": "Time Sent", - "valid": "Valid" + "valid": "Valid", + "revoke": "Revoke" } }, "server_rooms": { @@ -439,7 +441,8 @@ "role_permission_updated": "The role permission has been updated." }, "invitations": { - "invitation_sent": "An invitation has been sent." + "invitation_sent": "An invitation has been sent.", + "invitation_revoked": "An invitation has been revoked" } }, "error": { diff --git a/app/assets/locales/fa_IR.json b/app/assets/locales/fa_IR.json index c2ebc6cf7b..1a1097fa7b 100644 --- a/app/assets/locales/fa_IR.json +++ b/app/assets/locales/fa_IR.json @@ -14,6 +14,7 @@ "report": "گزارش", "share": "هم‌رسانی", "cancel": "انصراف", + "reset": "بازنشانی", "close": "بستن", "delete": "حذف", "copy": "رونوشت پیوند عضویت", @@ -229,7 +230,8 @@ "empty_invited_users_subtext": "هنگامی که وضعیت یک کاربر به دعوت‌شده تغییر می‌کند، در اینجا نمایان می‌شوند.", "invited": { "time_sent": "زمان ارسال‌شده", - "valid": "معتبر" + "valid": "معتبر", + "revoke": "ابطال" } }, "server_rooms": { @@ -429,7 +431,8 @@ "role_permission_updated": "دسترسی نقش به‌روز شده‌است." }, "invitations": { - "invitation_sent": "دعوت‌نامه ارسال شده‌است." + "invitation_sent": "دعوت‌نامه ارسال شده‌است.", + "invitation_revoked": "یک دعوت‌نامه ابطال شده است" } }, "error": { diff --git a/app/assets/locales/fr.json b/app/assets/locales/fr.json index 0ee437ee7b..ae585974d1 100644 --- a/app/assets/locales/fr.json +++ b/app/assets/locales/fr.json @@ -14,6 +14,7 @@ "report": "Signaler", "share": "Partager", "cancel": "Annuler", + "reset": "Réinitialiser", "close": "Fermer", "delete": "Supprimer", "copy": "Copier", @@ -229,7 +230,8 @@ "empty_invited_users_subtext": "Lorsque le statut d'un utilisateur passe à invité, il apparaîtra ici.", "invited": { "time_sent": "Heure d'envoi", - "valid": "Valide" + "valid": "Valide", + "revoke": "Révoquer" } }, "server_rooms": { @@ -429,7 +431,8 @@ "role_permission_updated": "L'autorisation pour ce rôle a été modifiée" }, "invitations": { - "invitation_sent": "L'invitation a été envoyée" + "invitation_sent": "L'invitation a été envoyée", + "invitation_revoked": "Une invitation a été révoquée." } }, "error": { diff --git a/app/assets/locales/ja.json b/app/assets/locales/ja.json index 181926bb0d..62d3c7dbed 100644 --- a/app/assets/locales/ja.json +++ b/app/assets/locales/ja.json @@ -14,6 +14,7 @@ "report": "報告", "share": "共有", "cancel": "キャンセル", + "reset": "リセット", "close": "閉じる", "delete": "削除", "copy": "参加リンクをコピー", @@ -229,7 +230,8 @@ "empty_invited_users_subtext": "ユーザーの状態が招待中に変わると、こちらに表示されます。", "invited": { "time_sent": "送付日時", - "valid": "有効" + "valid": "有効", + "revoke": "取り消す" } }, "server_rooms": { @@ -429,7 +431,8 @@ "role_permission_updated": "この役割の権限が更新されました。" }, "invitations": { - "invitation_sent": "招待状が送付されました" + "invitation_sent": "招待状が送付されました", + "invitation_revoked": "招待状を取り消しました" } }, "error": { diff --git a/app/controllers/api/v1/admin/invitations_controller.rb b/app/controllers/api/v1/admin/invitations_controller.rb index 6aab95298c..0ecaaf4ea6 100644 --- a/app/controllers/api/v1/admin/invitations_controller.rb +++ b/app/controllers/api/v1/admin/invitations_controller.rb @@ -60,6 +60,15 @@ def create logger.error "Failed to send invitations to #{params[:invitations][:emails]} - #{e}" render_error status: :bad_request end + + def destroy + invitation = Invitation.find(params[:id]) + if invitation.destroy + render_data status: :ok + else + render_error status: :not_found + end + end end end end diff --git a/app/controllers/api/v1/users_controller.rb b/app/controllers/api/v1/users_controller.rb index e891d596c9..d28c0834a3 100644 --- a/app/controllers/api/v1/users_controller.rb +++ b/app/controllers/api/v1/users_controller.rb @@ -166,7 +166,11 @@ def create_user_params end def update_user_params - @update_user_params ||= params.require(:user).permit(:name, :password, :avatar, :language, :role_id, :invite_token) + @update_user_params ||= if external_auth? + params.require(:user).permit(:password, :avatar, :language, :role_id, :invite_token) + else + params.require(:user).permit(:name, :password, :avatar, :language, :role_id, :invite_token) + end end def change_password_params diff --git a/app/javascript/components/admin/manage_users/InvitedUsersTable.jsx b/app/javascript/components/admin/manage_users/InvitedUsersTable.jsx index 35a3091191..2cfc2d70e0 100644 --- a/app/javascript/components/admin/manage_users/InvitedUsersTable.jsx +++ b/app/javascript/components/admin/manage_users/InvitedUsersTable.jsx @@ -16,9 +16,10 @@ import React, { useState } from 'react'; import PropTypes from 'prop-types'; -import { Table } from 'react-bootstrap'; +import { Table, Dropdown } from 'react-bootstrap'; import { useTranslation } from 'react-i18next'; -import { CheckIcon, XMarkIcon } from '@heroicons/react/24/solid'; +import { CheckIcon, XMarkIcon, ArchiveBoxXMarkIcon } from '@heroicons/react/24/solid'; +import { EllipsisVerticalIcon } from '@heroicons/react/24/outline'; import SortBy from '../../shared_components/search/SortBy'; import useInvitations from '../../../hooks/queries/admin/manage_users/useInvitations'; import Pagination from '../../shared_components/Pagination'; @@ -27,12 +28,14 @@ import EmptyUsersList from './EmptyUsersList'; import { localizeDateTimeString } from '../../../helpers/DateTimeHelper'; import { useAuth } from '../../../contexts/auth/AuthProvider'; import ManageUsersInvitedRowPlaceHolder from './ManageUsersInvitedRowPlaceHolder'; +import useRevokeUserInvite from '../../../hooks/mutations/admin/manage_users/useRevokeUserInvite'; export default function InvitedUsersTable({ searchInput }) { const { t } = useTranslation(); const [page, setPage] = useState(); const { isLoading, data: invitations } = useInvitations(searchInput, page); const currentUser = useAuth(); + const revokeUserInvite = useRevokeUserInvite(); if (!searchInput && invitations?.data?.length === 0) { return ; @@ -73,6 +76,17 @@ export default function InvitedUsersTable({ searchInput }) { { invitation.valid ? : } + + + + + revokeUserInvite.mutate(invitation.id)}> + + {t('admin.manage_users.invited.revoke')} + + + + )) ) diff --git a/app/javascript/components/users/user/forms/UpdateUserForm.jsx b/app/javascript/components/users/user/forms/UpdateUserForm.jsx index 7d524695b8..740f8d420f 100644 --- a/app/javascript/components/users/user/forms/UpdateUserForm.jsx +++ b/app/javascript/components/users/user/forms/UpdateUserForm.jsx @@ -70,7 +70,7 @@ export default function UpdateUserForm({ user }) { return (
- + { @@ -85,7 +85,7 @@ export default function UpdateUserForm({ user }) { )} - +