Merge branch 'bugfix/restoring-portal' of github.com:ONLYOFFICE/AppServer into bugfix/restoring-portal

This commit is contained in:
Tatiana Lopaeva 2023-01-26 13:01:32 +03:00
commit 7e201d4a4e
15 changed files with 151 additions and 54 deletions

View File

@ -41,8 +41,13 @@ KAFKA_HOST = os.environ["KAFKA_HOST"] if environ.get("KAFKA_HOST") else "kafka:9
RUN_FILE = sys.argv[1] if sys.argv[1] else "none"
LOG_FILE = sys.argv[2] if sys.argv[2] else "none"
REDIS_HOST=os.environ["REDIS_HOST"] if environ.get("REDIS_HOST") else "onlyoffice-redis"
RABBIT_HOST=os.environ["RABBIT_HOST"] if environ.get("RABBIT_HOST") else "onlyoffice-rabbitmq"
REDIS_HOST = os.environ["REDIS_HOST"] if environ.get("REDIS_HOST") else "onlyoffice-redis"
REDIS_PORT = os.environ["REDIS_PORT"] if environ.get("REDIS_PORT") else "6379"
RABBIT_HOST = os.environ["RABBIT_HOST"] if environ.get("RABBIT_HOST") else "onlyoffice-rabbitmq"
RABBIT_USER_NAME = os.environ["RABBIT_USER_NAME"] if environ.get("RABBIT_USER_NAME") else "guest"
RABBIT_PASSWORD = os.environ["RABBIT_PASSWORD"] if environ.get("RABBIT_PASSWORD") else "guest"
RABBIT_PORT = os.environ["RABBIT_PORT"] if environ.get("RABBIT_PORT") else "5672"
class RunServices:
def __init__(self, SERVICE_PORT, PATH_TO_CONF):
@ -160,11 +165,15 @@ writeJsonFile(filePath, jsonData)
filePath = "/app/onlyoffice/config/rabbitmq.json"
jsonData = openJsonFile(filePath)
updateJsonData(jsonData,"$.RabbitMQ.Hostname", RABBIT_HOST)
updateJsonData(jsonData,"$.RabbitMQ.UserName", RABBIT_USER_NAME)
updateJsonData(jsonData, "$.RabbitMQ.Password", RABBIT_PASSWORD)
updateJsonData(jsonData, "$.RabbitMQ.Port", RABBIT_PORT)
writeJsonFile(filePath, jsonData)
filePath = "/app/onlyoffice/config/redis.json"
jsonData = openJsonFile(filePath)
updateJsonData(jsonData,"$.Redis.Hosts.[0].Host", REDIS_HOST)
updateJsonData(jsonData,"$.Redis.Hosts.[0].Port", REDIS_PORT)
writeJsonFile(filePath, jsonData)
run = RunServices(SERVICE_PORT, PATH_TO_CONF)

View File

@ -57,7 +57,7 @@ public class TenantsModuleSpecifics : ModuleSpecificsBase
{
new RelationInfo("tenants_tenants", "id", "tenants_quota", "tenant"),
new RelationInfo("tenants_tenants", "id", "tenants_tariff", "tenant"),
new RelationInfo("tenants_tenants", "id", "tenants_tariff", "tariff", x => Convert.ToInt32(x["tariff"]) > 0),
new RelationInfo("tenants_tenants", "id", "tenants_tariff", "tariff"),
new RelationInfo("core_user", "id", "tenants_tenants", "owner_id", null, null, RelationImportance.Low)
};

View File

@ -75,7 +75,8 @@
"DeleteThemeNotice": "The theme will be deleted permanently. You will not be able to undo this action.",
"Disabled": "Disabled",
"DownloadCopy": "Download the copy",
"DownloadReportBtn": "Download and open report",
"DownloadReportBtnText": "Download report",
"DownloadReportDescription": "The report will be saved to My Documents",
"DownloadStatisticsText": "You can download the report for the data available during the selected storage period to view the detailed statistics.",
"EditColorScheme": "Edit color scheme",
"EditCurrentTheme": "Edit current theme",

View File

@ -33,16 +33,16 @@ const IntegrationWrapper = (props) => {
};
const data = [
{
id: "single-sign-on",
name: t("SingleSignOn"),
content: <SSO />,
},
{
id: "third-party-services",
name: t("Translations:ThirdPartyTitle"),
content: <ThirdParty />,
},
{
id: "single-sign-on",
name: t("SingleSignOn"),
content: <SSO />,
},
];
if (!isMobile) {

View File

@ -19,7 +19,6 @@ class PeopleTableHeader extends React.Component {
title: t("Common:User"),
resizable: true,
enable: true,
default: true,
sortBy: "AZ",
active: true,
minWidth: 180,
@ -44,6 +43,7 @@ class PeopleTableHeader extends React.Component {
title: t("Common:Action"),
enable: true,
resizable: true,
default: true,
onChange: this.onColumnChange,
},
];

View File

@ -20,6 +20,7 @@ const AuditTrail = (props) => {
getAuditTrailReport,
securityLifetime,
isAuditAvailable,
isLoadingDownloadReport,
} = props;
useEffect(() => {
@ -72,9 +73,11 @@ const AuditTrail = (props) => {
lifetime={securityLifetime.auditTrailLifeTime}
setLifetimeAuditSettings={setLifetimeAuditSettings}
content={getContent()}
downloadReport={t("DownloadReportBtn")}
downloadReport={t("DownloadReportBtnText")}
downloadReportDescription={t("DownloadReportDescription")}
getReport={getAuditTrailReport}
isSettingNotPaid={!isAuditAvailable}
isLoadingDownloadReport={isLoadingDownloadReport}
/>
)}
</>
@ -90,6 +93,7 @@ export default inject(({ setup, auth }) => {
setLifetimeAuditSettings,
getAuditTrailReport,
securityLifetime,
isLoadingDownloadReport,
} = setup;
const { settingsStore, currentQuotaStore } = auth;
const { theme } = settingsStore;
@ -104,5 +108,6 @@ export default inject(({ setup, auth }) => {
getAuditTrailReport,
securityLifetime,
isAuditAvailable,
isLoadingDownloadReport,
};
})(withTranslation("Settings")(withRouter(AuditTrail)));

View File

@ -56,7 +56,15 @@ const MainContainer = styled.div`
}
}
.download-button {
${(props) => props.isSettingNotPaid && UnavailableStyles}
`;
const DownLoadWrapper = styled.div`
display: flex;
align-items: center;
gap: 12px;
.download-report_button {
width: auto;
height: auto;
font-size: 13px;
@ -76,7 +84,23 @@ const MainContainer = styled.div`
}
}
${(props) => props.isSettingNotPaid && UnavailableStyles}
.download-report_description {
font-style: normal;
font-weight: 600;
font-size: 12px;
line-height: 16px;
height: 16px;
margin: 0;
color: ${(props) =>
props.theme.client.settings.security.auditTrail
.downloadReportDescriptionColor};
}
@media ${hugeMobile} {
flex-direction: column-reverse;
}
`;
const HistoryMainContent = (props) => {
@ -94,8 +118,10 @@ const HistoryMainContent = (props) => {
securityLifetime,
content,
downloadReport,
downloadReportDescription,
getReport,
isSettingNotPaid,
isLoadingDownloadReport,
} = props;
const [lifeTime, setLifeTime] = useState(String(lifetime) || "180");
@ -191,15 +217,21 @@ const HistoryMainContent = (props) => {
<Text className="latest-text settings_unavailable">{downloadText}</Text>
</div>
{content}
<Button
className="download-button"
primary
label={downloadReport}
size="normal"
minwidth="auto"
onClick={() => getReport()}
isDisabled={isSettingNotPaid}
/>
<DownLoadWrapper>
<Button
className="download-report_button"
primary
label={downloadReport}
size="normal"
minwidth="auto"
onClick={() => getReport()}
isDisabled={isSettingNotPaid}
isLoading={isLoadingDownloadReport}
/>
<span className="download-report_description">
{downloadReportDescription}
</span>
</DownLoadWrapper>
</MainContainer>
);
};

View File

@ -209,22 +209,22 @@ export const settingsTree = [
tKey: "ManagementCategoryIntegration",
isHeader: true,
children: [
{
id: "portal-settings_catalog-single-sign-on",
key: "3-0",
icon: "",
link: "single-sign-on",
tKey: "SingleSignOn",
isCategory: true,
},
{
id: "portal-settings_catalog-third-party-services",
key: "3-1",
key: "3-0",
icon: "",
link: "third-party-services",
tKey: "ThirdPartyAuthorization",
isCategory: true,
},
{
id: "portal-settings_catalog-single-sign-on",
key: "3-1",
icon: "",
link: "single-sign-on",
tKey: "SingleSignOn",
isCategory: true,
},
{
id: "portal-settings_catalog-portal-integration",
key: "3-2",

View File

@ -16,6 +16,8 @@ class SettingsSetupStore {
logoutAllVisible = false;
viewAs = isMobile ? "row" : "table";
isLoadingDownloadReport = false;
security = {
accessRight: {
options: [],
@ -71,6 +73,10 @@ class SettingsSetupStore {
}
};
setIsLoadingDownloadReport = (state) => {
this.isLoadingDownloadReport = state;
};
setIsInit = (isInit) => {
this.isInit = isInit;
};
@ -268,9 +274,16 @@ class SettingsSetupStore {
};
getAuditTrailReport = async () => {
const res = await api.settings.getAuditTrailReport();
window.open(res);
return this.setAuditTrailReport(res);
try {
this.setIsLoadingDownloadReport(true);
const res = await api.settings.getAuditTrailReport();
window.open(res);
return this.setAuditTrailReport(res);
} catch (error) {
console.error(error);
} finally {
this.setIsLoadingDownloadReport(false);
}
};
setGreetingTitle = async (greetingTitle) => {

View File

@ -526,21 +526,21 @@ class MediaViewer extends React.Component {
{
key: "download",
label: t("Common:Download"),
icon: { DownloadReactSvgUrl },
icon: DownloadReactSvgUrl,
onClick: () => onClickDownload(targetFile, t),
disabled: false,
},
{
key: "rename",
label: t("Rename"),
icon: { RenameReactSvgUrl },
icon: RenameReactSvgUrl,
onClick: () => onClickRename(targetFile),
disabled: false,
},
{
key: "delete",
label: t("Common:Delete"),
icon: { TrashReactSvgUrl },
icon: TrashReactSvgUrl,
onClick: () => onClickDelete(targetFile, t),
disabled: false,
},
@ -551,7 +551,7 @@ class MediaViewer extends React.Component {
id: "option_room-info",
key: "room-info",
label: t("Common:Info"),
icon: { InfoOutlineReactSvgUrl },
icon: InfoOutlineReactSvgUrl,
onClick: () => {
return onShowInfoPanel(targetFile);
},
@ -560,21 +560,21 @@ class MediaViewer extends React.Component {
{
key: "download",
label: t("Common:Download"),
icon: { DownloadReactSvgUrl },
icon: DownloadReactSvgUrl,
onClick: () => onClickDownload(targetFile, t),
disabled: false,
},
{
key: "move-to",
label: t("MoveTo"),
icon: { MoveReactSvgUrl },
icon: MoveReactSvgUrl,
onClick: onMoveAction,
disabled: isPreviewFile,
},
// {
// key: "download-as",
// label: t("Translations:DownloadAs"),
// icon: {DownloadAsReactSvgUrl}, // TODO: uncomment when we can download media by changing the format
// icon: DownloadAsReactSvgUrl, // TODO: uncomment when we can download media by changing the format
// onClick: onClickDownloadAs,
// disabled: false,
// },
@ -582,7 +582,7 @@ class MediaViewer extends React.Component {
id: "option_copy-to",
key: "copy-to",
label: t("Translations:Copy"),
icon: { CopyReactSvgUrl },
icon: CopyReactSvgUrl,
onClick: onCopyAction,
disabled: isPreviewFile,
},
@ -590,14 +590,14 @@ class MediaViewer extends React.Component {
id: "option_create-copy",
key: "copy",
label: t("Common:Duplicate"),
icon: { DuplicateReactSvgUrl },
icon: DuplicateReactSvgUrl,
onClick: () => onDuplicate(targetFile, t),
disabled: isPreviewFile,
},
{
key: "rename",
label: t("Rename"),
icon: { RenameReactSvgUrl },
icon: RenameReactSvgUrl,
onClick: () => onClickRename(targetFile),
disabled: isPreviewFile,
},
@ -610,7 +610,7 @@ class MediaViewer extends React.Component {
{
key: "delete",
label: t("Common:Delete"),
icon: { TrashReactSvgUrl },
icon: TrashReactSvgUrl,
onClick: () => onClickDelete(targetFile, t),
disabled: isPreviewFile,
},

View File

@ -2941,6 +2941,9 @@ const Base = {
departmentColor: gray,
tooltipColor: lightCumulus,
},
auditTrail: {
downloadReportDescriptionColor: gray,
},
},
common: {

View File

@ -2942,6 +2942,9 @@ const Dark = {
departmentColor: "#858585",
tooltipColor: "#F5E9BA",
},
auditTrail: {
downloadReportDescriptionColor: "#858585",
},
},
common: {

View File

@ -532,15 +532,8 @@ public class FileStorageService<T> //: IFileStorageService
var parent = await folderDao.GetFolderAsync(parentId);
var providerInfo = await providerDao.GetProviderInfoAsync(parent.ProviderId);
if (providerInfo.RootFolderType != FolderType.VirtualRooms)
{
throw new InvalidDataException("Invalid provider type");
}
if (providerInfo.FolderId != null)
{
throw new InvalidOperationException("This provider already corresponds to the virtual room");
}
ErrorIf(providerInfo.RootFolderType != FolderType.VirtualRooms, FilesCommonResource.ErrorMessage_InvalidProvider);
ErrorIf(providerInfo.FolderId != null, FilesCommonResource.ErrorMessage_ProviderAlreadyConnect);
List<AceWrapper> aces = null;
@ -560,6 +553,8 @@ public class FileStorageService<T> //: IFileStorageService
_ => (await CreateCustomRoomAsync(title, parentId, @private), FolderType.CustomRoom),
};
ErrorIf(result.Item1.Id.Equals(result.Item1.RootId), FilesCommonResource.ErrorMessage_InvalidThirdPartyFolder);
if (@private)
{
await SetAcesForPrivateRoomAsync(result.Item1, aces, notify, sharingMessage);

View File

@ -771,6 +771,24 @@ namespace ASC.Files.Core.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Invalid provider.
/// </summary>
public static string ErrorMessage_InvalidProvider {
get {
return ResourceManager.GetString("ErrorMessage_InvalidProvider", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to It is not possible to use this folder to store the room.
/// </summary>
public static string ErrorMessage_InvalidThirdPartyFolder {
get {
return ResourceManager.GetString("ErrorMessage_InvalidThirdPartyFolder", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to The invitation link is invalid or it&apos;s validity has expired.
/// </summary>
@ -789,6 +807,15 @@ namespace ASC.Files.Core.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to This provider is already connected to the room.
/// </summary>
public static string ErrorMessage_ProviderAlreadyConnect {
get {
return ResourceManager.GetString("ErrorMessage_ProviderAlreadyConnect", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to You don&apos;t have permission to copy to this folder.
/// </summary>

View File

@ -354,12 +354,21 @@
<data name="ErrorMassage_ViewTrashItem" xml:space="preserve">
<value>You are not allowed to preview the elements in the Trash</value>
</data>
<data name="ErrorMessage_InvalidProvider" xml:space="preserve">
<value>Invalid provider</value>
</data>
<data name="ErrorMessage_InvalidThirdPartyFolder" xml:space="preserve">
<value>It is not possible to use this folder to store the room</value>
</data>
<data name="ErrorMessage_InvintationLink" xml:space="preserve">
<value>The invitation link is invalid or it's validity has expired</value>
</data>
<data name="ErrorMessage_PaidRole" xml:space="preserve">
<value>The role is only available to a paid user</value>
</data>
<data name="ErrorMessage_ProviderAlreadyConnect" xml:space="preserve">
<value>This provider is already connected to the room</value>
</data>
<data name="ErrorMessage_SecurityException_CopyToFolder" xml:space="preserve">
<value>You don't have permission to copy to this folder</value>
</data>