Fix Bug 69732 - [LDAP] User quota field does not work in LDAP settings because quotas are disabled by default on the portal

This commit is contained in:
Alexey Safronov 2024-08-19 15:32:59 +04:00
parent 2e734ff666
commit ee6df901ac
3 changed files with 174 additions and 3 deletions

View File

@ -95638,6 +95638,138 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>LdapQuotaInfo</name>
<description/>
<comment/>
<default_text/>
<translations>
<translation>
<language>ar-SA</language>
<approved>false</approved>
</translation>
<translation>
<language>az-Latn-AZ</language>
<approved>false</approved>
</translation>
<translation>
<language>bg-BG</language>
<approved>false</approved>
</translation>
<translation>
<language>cs-CZ</language>
<approved>false</approved>
</translation>
<translation>
<language>de-DE</language>
<approved>false</approved>
</translation>
<translation>
<language>el-GR</language>
<approved>false</approved>
</translation>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>es-ES</language>
<approved>false</approved>
</translation>
<translation>
<language>fi-FI</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
<translation>
<language>hy-AM</language>
<approved>false</approved>
</translation>
<translation>
<language>it-IT</language>
<approved>false</approved>
</translation>
<translation>
<language>ja-JP</language>
<approved>false</approved>
</translation>
<translation>
<language>ko-KR</language>
<approved>false</approved>
</translation>
<translation>
<language>lo-LA</language>
<approved>false</approved>
</translation>
<translation>
<language>lv-LV</language>
<approved>false</approved>
</translation>
<translation>
<language>nl-NL</language>
<approved>false</approved>
</translation>
<translation>
<language>pl-PL</language>
<approved>false</approved>
</translation>
<translation>
<language>pt-BR</language>
<approved>false</approved>
</translation>
<translation>
<language>pt-PT</language>
<approved>false</approved>
</translation>
<translation>
<language>ro-RO</language>
<approved>false</approved>
</translation>
<translation>
<language>ru-RU</language>
<approved>false</approved>
</translation>
<translation>
<language>si-SI</language>
<approved>false</approved>
</translation>
<translation>
<language>sk-SK</language>
<approved>false</approved>
</translation>
<translation>
<language>sl-SI</language>
<approved>false</approved>
</translation>
<translation>
<language>sr-Cyrl-RS</language>
<approved>false</approved>
</translation>
<translation>
<language>sr-Latn-RS</language>
<approved>false</approved>
</translation>
<translation>
<language>tr-TR</language>
<approved>false</approved>
</translation>
<translation>
<language>uk-UA</language>
<approved>false</approved>
</translation>
<translation>
<language>vi-VN</language>
<approved>false</approved>
</translation>
<translation>
<language>zh-CN</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<concept_node>
<name>LdapSecondName</name>
<description/>

View File

@ -36,6 +36,7 @@
"LdapPortNumber": "Port Number",
"LdapPortNumberTooltip": "Enter the port number for your LDAP server/Active Directory.",
"LdapQuota": "User quota",
"LdapQuotaInfo": "To be able to use this attribute, enable user quota in the <0>Storage management settings</0>",
"LdapSecondName": "Second name",
"LdapSendWelcomeLetter": "Send welcome letter",
"LdapSendWelcomeLetterTooltip": "If checked all new users will receive welcome letter. Available only when Mail Attribute is mapped to LDAP.",

View File

@ -26,7 +26,8 @@
import React, { useRef } from "react";
import { inject, observer } from "mobx-react";
import { useTranslation } from "react-i18next";
import { Trans, useTranslation } from "react-i18next";
import { useNavigate } from "react-router-dom";
import { Box } from "@docspace/shared/components/box";
import { TextInput } from "@docspace/shared/components/text-input";
@ -39,6 +40,8 @@ import { FieldContainer } from "@docspace/shared/components/field-container";
import AccessSelector from "SRC_DIR/components/AccessSelector";
import { isMobile } from "@docspace/shared/utils";
import LdapFieldComponent from "./LdapFieldComponent";
import { Link } from "@docspace/shared/components/link";
import { globalColors } from "@docspace/shared/themes";
const FIRST_NAME = "firstName",
SECOND_NAME = "secondName",
@ -68,10 +71,14 @@ const AttributeMapping = (props) => {
isLdapEnabled,
isUIDisabled,
isDefaultUsersQuotaSet,
} = props;
const { t } = useTranslation("Ldap");
const navigate = useNavigate();
const inputsRef = useRef();
const onChangeValue = (e) => {
@ -100,6 +107,10 @@ const AttributeMapping = (props) => {
setUserType(option.access);
};
const goToStarageManagement = () => {
navigate("/portal-settings/management/disk-space");
};
return (
<>
<div className="ldap_attribute-mapping-text">
@ -202,9 +213,32 @@ const AttributeMapping = (props) => {
onChange={onChangeValue}
value={userQuotaLimit}
scale
isDisabled={!isLdapEnabled || isUIDisabled}
isDisabled={
!isDefaultUsersQuotaSet || !isLdapEnabled || isUIDisabled
}
tabIndex={11}
/>
{!isDefaultUsersQuotaSet && (
<Text
as={"span"}
fontWeight={400}
fontSize="12px"
lineHeight="16px"
>
<Trans
t={t}
i18nKey="LdapQuotaInfo"
ns="Ldap"
components={[
<Link
type="action"
color={globalColors.link}
onClick={goToStarageManagement}
/>,
]}
/>
</Text>
)}
</FieldContainer>
</Box>
<Box marginProp="24px 0 24px 0">
@ -250,7 +284,7 @@ const AttributeMapping = (props) => {
);
};
export default inject(({ ldapStore }) => {
export default inject(({ ldapStore, currentQuotaStore }) => {
const {
setMail,
setFirstName,
@ -274,6 +308,8 @@ export default inject(({ ldapStore }) => {
userType,
} = requiredSettings;
const { isDefaultUsersQuotaSet } = currentQuotaStore;
return {
setFirstName,
setSecondName,
@ -292,5 +328,7 @@ export default inject(({ ldapStore }) => {
errors,
isLdapEnabled,
isUIDisabled,
isDefaultUsersQuotaSet,
};
})(observer(AttributeMapping));