Skip to content

Commit d5c7b2f

Browse files
LHBruneton-C2Ccmangeat
authored andcommitted
list anonymous accesses from tools with delete button
1 parent fc85147 commit d5c7b2f

File tree

4 files changed

+138
-3
lines changed

4 files changed

+138
-3
lines changed

web-ui/src/main/resources/catalog/js/admin/AdminToolsController.js

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@
8282
"gnUtilityService",
8383
"gnSearchSettings",
8484
"gnGlobalSettings",
85+
"gnLangs",
8586

8687
function (
8788
$scope,
@@ -97,7 +98,8 @@
9798
gnConfigService,
9899
gnUtilityService,
99100
gnSearchSettings,
100-
gnGlobalSettings
101+
gnGlobalSettings,
102+
gnLangs
101103
) {
102104
$scope.modelOptions = angular.copy(gnGlobalSettings.modelOptions);
103105

@@ -116,6 +118,12 @@
116118
label: "transfertPrivs",
117119
icon: "fa-user",
118120
href: "#/tools/transferownership"
121+
},
122+
{
123+
type: "anonymousaccess",
124+
label: "anonymousAccessList",
125+
icon: "fa-eye",
126+
href: "#/tools/anonymousaccess"
119127
}
120128
]
121129
};
@@ -355,6 +363,46 @@
355363
});
356364
});
357365
};
366+
367+
$scope.recordsWithAnonymousAccess = [];
368+
369+
function loadAnonymousAccessList() {
370+
$http.get("../api/anonymousAccessLink").then(function (response) {
371+
var flattened = response.data.map((item) => {
372+
return {
373+
id: item.metadataId,
374+
uuid: item.metadataUuid,
375+
resourceTitle:
376+
item.getResultSource.resourceTitleObject["lang" + gnLangs.current] ||
377+
item.getResultSource.resourceTitleObject.default,
378+
resourceAbstract:
379+
item.getResultSource.resourceAbstractObject["lang" + gnLangs.current] ||
380+
item.getResultSource.resourceAbstractObject.default,
381+
recordOwner: item.getResultSource.recordOwner,
382+
changeDate: item.getResultSource.dateStamp
383+
};
384+
});
385+
$scope.recordsWithAnonymousAccess = flattened;
386+
});
387+
}
388+
389+
loadAnonymousAccessList();
390+
391+
$scope.deleteAnonymousAccess = function (metadataUuid) {
392+
return $http.delete("../api/anonymousAccessLink/" + metadataUuid).then(
393+
function () {
394+
loadAnonymousAccessList();
395+
$rootScope.$broadcast("StatusUpdated", {
396+
msg: $translate.instant("anonymousAccessDeleted"),
397+
timeout: 2,
398+
type: "success"
399+
});
400+
},
401+
function () {
402+
loadAnonymousAccessList();
403+
}
404+
);
405+
};
358406
}
359407
]);
360408
})();

web-ui/src/main/resources/catalog/locales/en-admin.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,6 +1620,8 @@
16201620
"datahubEnabled": "Enable Datahub interface for this portal",
16211621
"datahubInfo": "This Datahub interface is accessible <a href='../../{{uuid}}/datahub'>here</a>.",
16221622
"datahubPluginNotInstalled-help": "The Datahub plugin is not installed. Please refer to <a href='https://docs.geonetwork-opensource.org/4.4/install-guide/plugins/#datahub-integration-gn-datahub-integration' target='_blank'>the related documentation for more information</a> on installation and usage.",
1623-
"harvesterErrorRetrieveSources": "Error retrieving remote catalogs"
1623+
"harvesterErrorRetrieveSources": "Error retrieving remote catalogs",
1624+
"anonymousAccessList": "Anonymous Access List",
1625+
"anonymousAccessListDelete": "Delete",
1626+
"anonymousAccessListEmpty": "No anonymous access to display"
16241627
}
1625-

web-ui/src/main/resources/catalog/style/gn_admin.less

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -266,3 +266,27 @@ ul > li.list-group-item > input {
266266
width: 33%;
267267
}
268268
}
269+
270+
#gn-anonymous-access-list {
271+
.table.gn-results-anonymous-access td {
272+
padding: 6px 3px;
273+
.btn-group {
274+
margin-top: 3px;
275+
.btn-single {
276+
border-radius: 4px;
277+
}
278+
}
279+
.col-lg-8,
280+
.col-md-8,
281+
.col-lg-4,
282+
.col-md-4 {
283+
padding-left: 0;
284+
padding-right: 0;
285+
}
286+
@media (min-width: @screen-md-min) {
287+
.btn-group {
288+
float: right;
289+
}
290+
}
291+
}
292+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<p data-ng-show="recordsWithAnonymousAccess.length === 0">
2+
{{'anonymousAccessListEmpty' | translate}}
3+
</p>
4+
<div id="gn-anonymous-access-list" data-ng-show="recordsWithAnonymousAccess.length > 0">
5+
<table class="table gn-results-anonymous-access">
6+
<tr data-ng-repeat="md in recordsWithAnonymousAccess">
7+
<td>
8+
<gn-md-type-widget metadata="md"></gn-md-type-widget>
9+
<gn-md-type-inspire-validation-widget
10+
metadata="md"
11+
data-ng-if="isInspireEnabled"
12+
></gn-md-type-inspire-validation-widget>
13+
</td>
14+
<td>
15+
<div class="row">
16+
<div class="col-lg-8 col-md-8">
17+
<div class="clearfix">
18+
<div class="pull-left">
19+
<a
20+
href=""
21+
data-ng-href="catalog.search#/metadata/{{md.uuid}}"
22+
title="{{md.resourceAbstract}}"
23+
class="gn-break"
24+
>
25+
<i
26+
data-ng-show="md.resourceTitle.trim()=='' || md.resourceTitle===undefined"
27+
>{{'missingTitle' | translate}}</i
28+
>
29+
{{md.resourceTitle}}
30+
</a>
31+
<div class="gn-record-details text-muted">
32+
<small><span data-translate="">owner</span>:</small>
33+
<small>{{::md.recordOwner}}</small>
34+
&centerdot;
35+
<small data-translate="">updatedOn</small>
36+
<small
37+
class="text-muted"
38+
data-gn-humanize-time="{{md.changeDate}}"
39+
data-from-now=""
40+
></small>
41+
</div>
42+
</div>
43+
</div>
44+
</div>
45+
<div class="col-lg-4 col-md-4 gn-nopadding-right">
46+
<div class="btn-group">
47+
<a
48+
class="btn btn-default btn-single"
49+
href=""
50+
data-ng-click="deleteAnonymousAccess(md.uuid)"
51+
title="{{'anonymousAccessListDelete' | translate}}"
52+
>
53+
<i class="fa fa-eye-slash text-danger"></i>
54+
</a>
55+
</div>
56+
</div>
57+
</div>
58+
</td>
59+
</tr>
60+
</table>
61+
</div>

0 commit comments

Comments
 (0)