Skip to content

Commit 2835aa4

Browse files
author
xujiaming
committed
1.portal.js新增资源共享权限设置接口; 新增updateResourcesShareSetting(资源共享设置)、iPortalShareParam(共享设置参数类)、iPortalShareEntity(共享设置参数实体类)
2.添加UT测试 review huangqh
1 parent 9a4be7f commit 2835aa4

File tree

11 files changed

+151
-2
lines changed

11 files changed

+151
-2
lines changed

src/common/iPortal/iPortal.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import { IPortalMapdashboardsQueryParam } from "./iPortalMapdashboardsQueryParam
1717
import { IPortalQueryParam } from "./iPortalQueryParam";
1818
import { IPortalQueryResult } from "./iPortalQueryResult";
1919
import { IPortalResource } from "./iPortalResource";
20+
import { IPortalShareParam } from "./iPortalShareParam";
2021

2122
/**
2223
* @class SuperMap.iPortal
@@ -50,7 +51,11 @@ export class IPortal extends IPortalServiceBase {
5051
*/
5152
queryResources(queryParams) {
5253
if (!(queryParams instanceof IPortalQueryParam)) {
53-
return null;
54+
return new Promise( function(resolve){
55+
resolve(
56+
"queryParams is not instanceof iPortalQueryParam !"
57+
);
58+
});
5459
}
5560
var me = this;
5661
var resourceUrl = this.iportalUrl + "/gateway/catalog/resource/search.json";
@@ -71,6 +76,33 @@ export class IPortal extends IPortalServiceBase {
7176
}
7277

7378

79+
/**
80+
* @function SuperMap.iPortal.prototype.updateResourcesShareSetting
81+
* @description 查询资源。
82+
* @param {SuperMap.updateResourcesShareSetting} shareParams - 查询参数。
83+
* @returns {Promise} 返回包含所有资源结果的 Promise 对象。
84+
*/
85+
updateResourcesShareSetting(shareParams) {
86+
if (!(shareParams instanceof IPortalShareParam)) {
87+
return new Promise( function(resolve){
88+
resolve(
89+
"shareParams is not instanceof iPortalShareParam !"
90+
);
91+
});
92+
}
93+
var resourceUrlName = shareParams.resourceType.replace("_","").toLowerCase()+"s";
94+
if(resourceUrlName === "datas"){
95+
resourceUrlName = "mycontent/"+resourceUrlName;
96+
}
97+
var cloneShareParams = {
98+
ids: shareParams.ids,
99+
entities: shareParams.entities
100+
}
101+
var shareUrl = this.iportalUrl + "/web/"+resourceUrlName+"/sharesetting.json";
102+
return this.request("PUT", shareUrl, JSON.stringify(cloneShareParams)).then(function(result) {
103+
return result;
104+
});
105+
}
74106
/**
75107
* @function SuperMap.iPortal.prototype.queryServices
76108
* @description 查询服务。
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
2+
* This program are made available under the terms of the Apache License, Version 2.0
3+
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4+
import {SuperMap} from '../SuperMap';
5+
import {Util} from '../commontypes/Util';
6+
7+
/**
8+
* @class SuperMap.iPortalShareEntity
9+
* @classdesc iPortal 资源查询参数。
10+
* @category iPortal/Online
11+
* @param {Object} params - iPortal 资源查询具体参数。
12+
*
13+
*/
14+
export class IPortalShareEntity {
15+
16+
constructor(params) {
17+
params = params || {};
18+
this.permissionType = ""; // SEARCH READ READWRITE DOWNLOAD
19+
this.entityType = ""; // USER DEPARTMENT IPORTALGROUP
20+
this.entityName = "GUEST"; // GUEST or 具体用户 name
21+
this.entityId = null;
22+
Util.extend(this, params);
23+
}
24+
}
25+
SuperMap.iPortalShareEntity = IPortalShareEntity;
26+
27+
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* Copyright© 2000 - 2019 SuperMap Software Co.Ltd. All rights reserved.
2+
* This program are made available under the terms of the Apache License, Version 2.0
3+
* which accompanies this distribution and is available at http://www.apache.org/licenses/LICENSE-2.0.html.*/
4+
import {SuperMap} from '../SuperMap';
5+
import {Util} from '../commontypes/Util';
6+
7+
/**
8+
* @class SuperMap.iPortalShareParam
9+
* @classdesc iPortal 资源查询参数。
10+
* @category iPortal/Online
11+
* @param {Object} params - iPortal 资源查询具体参数。
12+
*
13+
*/
14+
export class IPortalShareParam {
15+
16+
constructor(params) {
17+
params = params || {};
18+
this.ids = [];
19+
this.entities = [];
20+
this.resourceType = ""; // MAP SERVICE SCENE DATA INSIGHTS_WORKSPACE MAP_DASHBOARD
21+
Util.extend(this, params);
22+
}
23+
}
24+
SuperMap.iPortalShareParam = IPortalShareParam;
25+
26+

src/common/iPortal/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import {IPortal} from './iPortal';
55
import {IPortalQueryParam} from './iPortalQueryParam';
66
import {IPortalResource} from './iPortalResource';
77
import {IPortalQueryResult} from './iPortalQueryResult';
8+
import {IPortalShareParam} from './iPortalShareParam';
9+
import {IPortalShareEntity} from './iPortalShareEntity';
810
import {IPortalMap} from './iPortalMap'
911
import {IPortalMapsQueryParam} from './iPortalMapsQueryParam';
1012
import {IPortalService} from './iPortalService';
@@ -21,6 +23,8 @@ export {IPortal} ;
2123
export {IPortalQueryParam};
2224
export {IPortalResource};
2325
export {IPortalQueryResult};
26+
export {IPortalShareParam};
27+
export {IPortalShareEntity};
2428
export {IPortalMap};
2529
export {IPortalMapsQueryParam} ;
2630
export {IPortalService} ;

src/common/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ import {
100100
IPortalQueryParam,
101101
IPortalResource,
102102
IPortalQueryResult,
103+
IPortalShareParam,
104+
IPortalShareEntity,
103105
IPortalMap,
104106
IPortalMapsQueryParam,
105107
IPortalInsight,
@@ -560,6 +562,8 @@ export {
560562
IPortalQueryParam,
561563
IPortalResource,
562564
IPortalQueryResult,
565+
IPortalShareParam,
566+
IPortalShareEntity,
563567
IPortalMap,
564568
IPortalMapsQueryParam,
565569
IPortalInsight,

src/leaflet/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ import {
7171
IPortalQueryParam,
7272
IPortalResource,
7373
IPortalQueryResult,
74+
IPortalShareParam,
75+
IPortalShareEntity,
7476
IPortalMap,
7577
IPortalMapsQueryParam,
7678
IPortalInsight,
@@ -533,6 +535,8 @@ export {
533535
IPortalQueryParam,
534536
IPortalResource,
535537
IPortalQueryResult,
538+
IPortalShareParam,
539+
IPortalShareEntity,
536540
IPortalMap,
537541
IPortalMapsQueryParam,
538542
IPortalInsight,

src/mapboxgl/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export {
7171
IPortalQueryParam,
7272
IPortalResource,
7373
IPortalQueryResult,
74+
IPortalShareParam,
75+
IPortalShareEntity,
7476
IPortalMap,
7577
IPortalMapsQueryParam,
7678
IPortalInsight,

src/openlayers/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export {
7171
IPortalQueryParam,
7272
IPortalResource,
7373
IPortalQueryResult,
74+
IPortalShareParam,
75+
IPortalShareEntity,
7476
IPortalMap,
7577
IPortalMapsQueryParam,
7678
IPortalService,

test/common/iPortal/iPortalQueryParamSpec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {IPortalQueryParam} from '../../../src/common/iPortal/IPortalQueryParam';
1+
import {IPortalQueryParam} from '../../../src/common/iPortal/iPortalQueryParam';
22

33
describe('IPortalQueryParam', () => {
44
it('resourceType', () => {
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import {IPortalShareEntity} from '../../../src/common/iPortal/iPortalShareEntity';
2+
3+
describe('IPortalShareEntity', () => {
4+
it('permissionType', () => {
5+
var param = new IPortalShareEntity({permissionType: 'SEARCH'});
6+
expect(param).not.toBeNull();
7+
expect(param.permissionType).toEqual('SEARCH');
8+
});
9+
10+
it('entityType', () => {
11+
var param = new IPortalShareEntity({ entityType: "DEPARTMENT" });
12+
expect(param).not.toBeNull();
13+
expect(param.entityType).toEqual("DEPARTMENT");
14+
});
15+
16+
it('entityName', () => {
17+
var param = new IPortalShareEntity({ entityName: "GUEST" });
18+
expect(param).not.toBeNull();
19+
expect(param.entityName).toEqual("GUEST");
20+
});
21+
22+
it('entityId', () => {
23+
var param = new IPortalShareEntity({ entityId: 123 });
24+
expect(param).not.toBeNull();
25+
expect(param.entityId).toEqual(123);
26+
});
27+
});

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy