!152 只读权限 沙箱汇聚

Merge pull request !152 from xuqian0131/master
This commit is contained in:
openharmony_ci 2024-05-30 06:13:15 +00:00 committed by Gitee
commit aa04f03a0b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 1 additions and 26 deletions

View File

@ -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)) {

View File

@ -82,9 +82,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)[]>());
}
@ -157,8 +154,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]);
@ -401,16 +396,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