mirror of
https://gitee.com/openharmony/applications_dlp_manager
synced 2024-11-24 02:19:49 +00:00
readonly open with gathering
Signed-off-by: xuqian <xuqian65@huawei.com>
This commit is contained in:
parent
767408a43a
commit
a3490aea7b
@ -86,17 +86,6 @@ export default class DataAbility extends ServiceExtensionAbility {
|
||||
let sandboxAppIndex: number = data.appIndex;
|
||||
let key: string = bundleName + sandboxAppIndex;
|
||||
|
||||
let authPerm2Sandbox:Map<dlpPermission.DLPFileAccess, (number | string)[]> =
|
||||
GlobalContext.load('authPerm2Sandbox') as Map<dlpPermission.DLPFileAccess, (number | string)[]>;
|
||||
for (let item of Array.from<(dlpPermission.DLPFileAccess | (number | string)[])[]>(authPerm2Sandbox)) {
|
||||
let itemKey = item[0];
|
||||
let itemValue = item[1];
|
||||
const app: string = (itemValue[0] as string) + (itemValue[1] as number);
|
||||
if (key === app) {
|
||||
authPerm2Sandbox.delete(itemKey as dlpPermission.DLPFileAccess);
|
||||
}
|
||||
}
|
||||
|
||||
let token2File:Map<number, (number | string | dlpPermission.DLPFile)[]> =
|
||||
GlobalContext.load('token2File') as Map<number, (number | string | dlpPermission.DLPFile)[]>;
|
||||
for (let item of Array.from<(number | (number | string | dlpPermission.DLPFile)[])[]>(token2File)) {
|
||||
|
@ -83,9 +83,6 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
if (!GlobalContext.load('fileOpenHistory')) {
|
||||
GlobalContext.store('fileOpenHistory', new Map<string, (number | string)[]>());
|
||||
}
|
||||
if (!GlobalContext.load('authPerm2Sandbox')) {
|
||||
GlobalContext.store('authPerm2Sandbox', new Map<dlpPermission.DLPFileAccess, (number | string)[]>());
|
||||
}
|
||||
if (!GlobalContext.load('token2File')) {
|
||||
GlobalContext.store('token2File', new Map<number, (number | string | dlpPermission.DLPFile)[]>());
|
||||
}
|
||||
@ -158,8 +155,6 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
(GlobalContext.load('fileOpenHistory') as Map<string, (number | string)[]>).set(
|
||||
this.uri, [this.sandboxBundleName, this.appIndex, this.linkFileName, this.linkUri]
|
||||
);
|
||||
(GlobalContext.load('authPerm2Sandbox') as Map<dlpPermission.DLPFileAccess,
|
||||
(number | string)[]>).set(this.authPerm, [this.sandboxBundleName, this.appIndex]);
|
||||
(GlobalContext.load('token2File') as Map<number, (number | string | dlpPermission.DLPFile |
|
||||
dlpPermission.DLPFileAccess | null)[]>).set(this.tokenId,
|
||||
[this.dlpFile, this.sandboxBundleName, this.appIndex, this.authPerm, this.uri, null, -1]);
|
||||
@ -402,16 +397,7 @@ export default class ViewAbility extends ServiceExtensionAbility {
|
||||
} else {
|
||||
await this.getOpenDLPFile(startId);
|
||||
}
|
||||
this.gatheringType = await dlpPermission.getDLPGatheringPolicy();
|
||||
let authPerm2Sandbox: Map<dlpPermission.DLPFileAccess, (number | string)[]> =
|
||||
GlobalContext.load('authPerm2Sandbox') as Map<dlpPermission.DLPFileAccess, (number | string)[]>;
|
||||
if (authPerm2Sandbox.has(this.authPerm) &&
|
||||
this.gatheringType === dlpPermission.GatheringPolicyType.GATHERING) {
|
||||
this.appIndex = authPerm2Sandbox.get(this.authPerm)?.[1] as number;
|
||||
HiLog.info(TAG, `Dlp gathering is on: ${this.fileName}, to sandbox: ${this.sandboxBundleName}${this.appIndex}`);
|
||||
this.sortByAuthPerm = true;
|
||||
}
|
||||
if (!this.alreadyOpen && !this.sortByAuthPerm) {
|
||||
if (!this.alreadyOpen) {
|
||||
hiTraceMeter.startTrace('DlpInstallSandboxJs', startId);
|
||||
let appInfo: dlpPermission.DLPSandboxInfo = await dlpPermission.installDLPSandbox(
|
||||
this.sandboxBundleName, this.authPerm, this.userId, this.uri
|
||||
|
Loading…
Reference in New Issue
Block a user