diff --git a/common/ASC.Api.Core/Core/BaseStartup.cs b/common/ASC.Api.Core/Core/BaseStartup.cs index 2914275336..ab21912d57 100644 --- a/common/ASC.Api.Core/Core/BaseStartup.cs +++ b/common/ASC.Api.Core/Core/BaseStartup.cs @@ -197,6 +197,7 @@ public abstract class BaseStartup config.Filters.Add(new TypeFilterAttribute(typeof(TenantStatusFilter))); config.Filters.Add(new TypeFilterAttribute(typeof(PaymentFilter))); config.Filters.Add(new TypeFilterAttribute(typeof(IpSecurityFilter))); + config.Filters.Add(new TypeFilterAttribute(typeof(ProductSecurityFilter))); config.Filters.Add(new CustomResponseFilterAttribute()); config.Filters.Add(new CustomExceptionFilterAttribute()); config.Filters.Add(new TypeFilterAttribute(typeof(WebhooksGlobalFilterAttribute))); diff --git a/common/ASC.Api.Core/Middleware/ProductSecurityFilter.cs b/common/ASC.Api.Core/Middleware/ProductSecurityFilter.cs index 896e66fe73..090a732bc2 100644 --- a/common/ASC.Api.Core/Middleware/ProductSecurityFilter.cs +++ b/common/ASC.Api.Core/Middleware/ProductSecurityFilter.cs @@ -38,9 +38,28 @@ public class ProductSecurityFilter : IResourceFilter static ProductSecurityFilter() { + var blog = new Guid("6a598c74-91ae-437d-a5f4-ad339bd11bb2"); + var bookmark = new Guid("28b10049-dd20-4f54-b986-873bc14ccfc7"); + var forum = new Guid("853b6eb9-73ee-438d-9b09-8ffeedf36234"); + var news = new Guid("3cfd481b-46f2-4a4a-b55c-b8c0c9def02c"); + var wiki = new Guid("742cf945-cbbc-4a57-82d6-1600a12cf8ca"); + var photo = new Guid("9d51954f-db9b-4aed-94e3-ed70b914e101"); + _products = new Dictionary { - { "files", WebItemManager.DocumentsProductID } + { "blog", blog }, + { "bookmark", bookmark }, + { "event", news }, + { "forum", forum }, + { "photo", photo }, + { "wiki", wiki }, + { "birthdays", WebItemManager.BirthdaysProductID }, + { "community", WebItemManager.CommunityProductID }, + { "crm", WebItemManager.CRMProductID }, + { "files", WebItemManager.DocumentsProductID }, + { "project", WebItemManager.ProjectsProductID }, + { "calendar", WebItemManager.CalendarProductID }, + { "mail", WebItemManager.MailProductID }, }; } diff --git a/config/autofac.products.json b/config/autofac.products.json index 546087a39c..f08a8c6a83 100644 --- a/config/autofac.products.json +++ b/config/autofac.products.json @@ -1,4 +1,22 @@ { "components": [ + { + "type": "ASC.People.PeopleProduct, ASC.People", + "services": [ + { + "type": "ASC.Web.Core.IWebItem, ASC.Web.Core" + } + ], + "instanceScope": "InstancePerLifetimeScope" + }, + { + "type": "ASC.Files.ApiProductEntryPoint, ASC.Files", + "services": [ + { + "type": "ASC.Web.Core.IWebItem, ASC.Web.Core" + } + ], + "instanceScope": "InstancePerLifetimeScope" + } ] } diff --git a/packages/client/src/components/dialogs/ChangeEmailDialog/index.js b/packages/client/src/components/dialogs/ChangeEmailDialog/index.js index 87db3d832d..3d5145717c 100644 --- a/packages/client/src/components/dialogs/ChangeEmailDialog/index.js +++ b/packages/client/src/components/dialogs/ChangeEmailDialog/index.js @@ -45,15 +45,10 @@ class ChangeEmailDialogComponent extends React.Component { onSendEmailChangeInstructions = () => { const { email } = this.state; - const { - user, - updateProfileInUsers, - updateProfile, - profile, - fromList, - } = this.props; + const { user, updateProfileInUsers, updateProfile, fromList } = this.props; const { id } = user; - const newProfile = profile; + const newProfile = user; + newProfile.email = email; this.setState({ isRequestRunning: true }, () => { sendInstructionsToChangeEmail(id, email) diff --git a/packages/client/src/pages/AccountsHome/Section/Body/Dialogs.js b/packages/client/src/pages/AccountsHome/Section/Body/Dialogs.js index f9ce6c7511..24bd399bc1 100644 --- a/packages/client/src/pages/AccountsHome/Section/Body/Dialogs.js +++ b/packages/client/src/pages/AccountsHome/Section/Body/Dialogs.js @@ -43,7 +43,6 @@ const Dialogs = ({ visible={changeEmail} onClose={closeDialogs} user={data} - profile={profile} fromList /> )} @@ -140,10 +139,8 @@ export default inject(({ auth, peopleStore }) => { const { user: profile } = auth.userStore; - const { - changeNameVisible, - setChangeNameVisible, - } = peopleStore.targetUserStore; + const { changeNameVisible, setChangeNameVisible } = + peopleStore.targetUserStore; const { tfaStore } = auth; diff --git a/packages/client/src/pages/Profile/Section/Body/sub-components/main-profile/index.js b/packages/client/src/pages/Profile/Section/Body/sub-components/main-profile/index.js index c5c043ae20..e3aa1dd9b7 100644 --- a/packages/client/src/pages/Profile/Section/Body/sub-components/main-profile/index.js +++ b/packages/client/src/pages/Profile/Section/Body/sub-components/main-profile/index.js @@ -438,7 +438,6 @@ const MainProfile = (props) => { visible={changeEmailVisible} onClose={() => setChangeEmailVisible(false)} user={profile} - profile={profile} /> )} @@ -471,13 +470,8 @@ const MainProfile = (props) => { export default inject(({ auth, peopleStore }) => { const { withActivationBar, sendActivationLink } = auth.userStore; - const { - theme, - helpLink, - culture, - currentColorScheme, - documentationEmail, - } = auth.settingsStore; + const { theme, helpLink, culture, currentColorScheme, documentationEmail } = + auth.settingsStore; const { setIsLoading } = peopleStore.loadingStore; const { diff --git a/packages/common/components/Article/sub-components/article-payment-alert.js b/packages/common/components/Article/sub-components/article-payment-alert.js index c386898035..3f97e054d2 100644 --- a/packages/common/components/Article/sub-components/article-payment-alert.js +++ b/packages/common/components/Article/sub-components/article-payment-alert.js @@ -1,4 +1,4 @@ -import React, { useEffect } from "react"; +import React from "react"; import { inject, observer } from "mobx-react"; import { withRouter } from "react-router"; import { useTranslation, Trans } from "react-i18next"; @@ -15,28 +15,13 @@ const PROXY_BASE_URL = combineUrl( ); const ArticlePaymentAlert = ({ - pricePerManager, isFreeTariff, theme, - currencySymbol, - setPortalPaymentQuotas, currentTariffPlanTitle, toggleArticleOpen, - tariffPlanTitle, - isQuotaLoaded, - isQuotasLoaded, }) => { const { t, ready } = useTranslation("Common"); - useEffect(async () => { - if (isFreeTariff && isQuotaLoaded) - try { - await setPortalPaymentQuotas(); - } catch (e) { - console.error(e); - } - }, [isQuotaLoaded]); - const onClick = () => { const paymentPageUrl = combineUrl( PROXY_BASE_URL, @@ -55,16 +40,11 @@ const ArticlePaymentAlert = ({ ); const description = isFreeTariff - ? pricePerManager && ( - - From {{ currencySymbol }} - {{ price: pricePerManager }} per admin/power user /month - - ) + ? t("Common:GetMoreOptions") : t("Common:PayBeforeTheEndGracePeriod"); const additionalDescription = isFreeTariff - ? t("Common:ActivateBusinessPlan", { planName: tariffPlanTitle }) + ? t("Common:ActivatePremiumFeatures") : t("Common:GracePeriodActivated"); const color = isFreeTariff @@ -73,9 +53,6 @@ const ArticlePaymentAlert = ({ const isShowLoader = !ready; - if (!isQuotaLoaded) return <>; - if (isFreeTariff && !isQuotasLoaded) return <>; - return isShowLoader ? ( ) : ( @@ -95,29 +72,14 @@ const ArticlePaymentAlert = ({ export default withRouter( inject(({ auth }) => { - const { paymentQuotasStore, currentQuotaStore, settingsStore } = auth; - const { - currentTariffPlanTitle, - isLoaded: isQuotaLoaded, - } = currentQuotaStore; + const { currentQuotaStore, settingsStore } = auth; + const { currentTariffPlanTitle } = currentQuotaStore; const { theme, toggleArticleOpen } = settingsStore; - const { - setPortalPaymentQuotas, - planCost, - tariffPlanTitle, - isLoaded: isQuotasLoaded, - } = paymentQuotasStore; return { toggleArticleOpen, - setPortalPaymentQuotas, - pricePerManager: planCost.value, theme, - currencySymbol: planCost.currencySymbol, currentTariffPlanTitle, - tariffPlanTitle, - isQuotaLoaded, - isQuotasLoaded, }; })(observer(ArticlePaymentAlert)) ); diff --git a/public/locales/en/Common.json b/public/locales/en/Common.json index 9deda6b2cd..bbda7e96f2 100644 --- a/public/locales/en/Common.json +++ b/public/locales/en/Common.json @@ -7,6 +7,7 @@ "Actions": "Actions", "Activate": "Activate", "ActivateBusinessPlan": "Activate {{planName}} plan?", + "ActivatePremiumFeatures": "Activate premium features?", "Active": "Active", "AddButton": "Add", "AddFilter": "Add filter", @@ -109,6 +110,7 @@ "FullAccess": "Full access", "Gigabyte": "GB", "GracePeriodActivated": "Grace period activated", + "GetMoreOptions": "Get more security and branding options", "HasFullAccess": "He has full access to the room", "HelpCenter": "Help Center", "HideArticleMenu": "Hide menu",