🐛 fix only office integration (#379)
🔒 Do not expose application API into (#372)" 🐛 Fix only office integration
This commit is contained in:
@@ -23,21 +23,21 @@ export class CompanyApplicationServiceImpl implements TdriveServiceProvider, Ini
|
|||||||
pk.application_id,
|
pk.application_id,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
//do not expose application secret
|
|
||||||
application.api = null;
|
|
||||||
|
|
||||||
if (!application?.id) {
|
if (!application?.id) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
const app = {
|
||||||
...{
|
...{
|
||||||
id: pk.application_id,
|
id: pk.application_id,
|
||||||
company_id: pk.company_id,
|
company_id: pk.company_id,
|
||||||
application_id: pk.application_id,
|
application_id: pk.application_id,
|
||||||
},
|
},
|
||||||
application: application,
|
application: { ...application },
|
||||||
};
|
};
|
||||||
|
app.application.api = null;
|
||||||
|
return app;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return null;
|
return null;
|
||||||
@@ -64,13 +64,14 @@ export class CompanyApplicationServiceImpl implements TdriveServiceProvider, Ini
|
|||||||
companyApplication.application_id,
|
companyApplication.application_id,
|
||||||
context,
|
context,
|
||||||
);
|
);
|
||||||
//do not expose application secret
|
if (application) {
|
||||||
application.api = null;
|
const app = {
|
||||||
if (application)
|
|
||||||
applications.push({
|
|
||||||
...companyApplication,
|
...companyApplication,
|
||||||
application: application,
|
application: { ...application },
|
||||||
});
|
};
|
||||||
|
app.application.api = null;
|
||||||
|
applications.push(app);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ListResult<CompanyApplicationWithApplication>("applications", applications, null);
|
return new ListResult<CompanyApplicationWithApplication>("applications", applications, null);
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ describe("The /users/quota API", () => {
|
|||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
platform = await init();
|
platform = await init();
|
||||||
currentUser = await UserApi.getInstance(platform);
|
currentUser = await UserApi.getInstance(platform);
|
||||||
});
|
}, 30000000);
|
||||||
|
|
||||||
afterEach(async () => {
|
afterEach(async () => {
|
||||||
await platform.tearDown();
|
await platform.tearDown();
|
||||||
|
|||||||
@@ -14,10 +14,12 @@ import {
|
|||||||
FileTypeUnknownIcon,
|
FileTypeUnknownIcon,
|
||||||
} from '@atoms/icons-colored';
|
} from '@atoms/icons-colored';
|
||||||
import * as Text from '@atoms/text';
|
import * as Text from '@atoms/text';
|
||||||
|
import { useCompanyApplications } from '@features/applications/hooks/use-company-applications';
|
||||||
import { DriveItem } from '@features/drive/types';
|
import { DriveItem } from '@features/drive/types';
|
||||||
import FileUploadAPIClient from '@features/files/api/file-upload-api-client';
|
import FileUploadAPIClient from '@features/files/api/file-upload-api-client';
|
||||||
import { formatDate } from '@features/global/utils/format-date';
|
import { formatDate } from '@features/global/utils/format-date';
|
||||||
import { formatSize } from '@features/global/utils/format-file-size';
|
import { formatSize } from '@features/global/utils/format-file-size';
|
||||||
|
import useRouterWorkspace from '@features/router/hooks/use-router-workspace';
|
||||||
import { useSearchModal } from '@features/search/hooks/use-search';
|
import { useSearchModal } from '@features/search/hooks/use-search';
|
||||||
import { SearchInputState } from '@features/search/state/search-input';
|
import { SearchInputState } from '@features/search/state/search-input';
|
||||||
import { UserType } from '@features/users/types/user';
|
import { UserType } from '@features/users/types/user';
|
||||||
@@ -32,8 +34,14 @@ import useRouterCompany from 'app/features/router/hooks/use-router-company';
|
|||||||
export default (props: { driveItem: DriveItem & { user?: UserType }}) => {
|
export default (props: { driveItem: DriveItem & { user?: UserType }}) => {
|
||||||
const history = useHistory();
|
const history = useHistory();
|
||||||
const input = useRecoilValue(SearchInputState);
|
const input = useRecoilValue(SearchInputState);
|
||||||
|
const currentWorkspaceId = useRouterWorkspace();
|
||||||
|
const companyApplications = useCompanyApplications();
|
||||||
const { user } = useCurrentUser();
|
const { user } = useCurrentUser();
|
||||||
const [_, setParentId] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }));
|
const [_, setParentId] = useRecoilState(DriveCurrentFolderAtom({ initialFolderId: 'user_'+user?.id }));
|
||||||
|
const tdriveDriveApplicationId =
|
||||||
|
companyApplications.applications.find(application => {
|
||||||
|
return application.identity.code === 'tdrive_drive';
|
||||||
|
})?.id || '';
|
||||||
const file = props.driveItem;
|
const file = props.driveItem;
|
||||||
const name = file?.name;
|
const name = file?.name;
|
||||||
const extension = name?.split('.').pop();
|
const extension = name?.split('.').pop();
|
||||||
|
|||||||
Reference in New Issue
Block a user