Make sure the "open" action is only visible when logged in as an administrator

This commit is contained in:
Jan Skovgaard
2018-08-22 11:31:07 +02:00
parent 05e48376c7
commit 015e89b927

View File

@@ -8,11 +8,22 @@
var evts = [];
function onInit() {
scope.allowOpenMediaType = true;
// By default don't show the open anchors
scope.allowOpenMediaType = false;
// If logged in as an admin user show the open anchors
userService.getCurrentUser().then(function (currentUser) {
if(currentUser.userType === "admin"){
scope.allowOpenMediaType = true;
}
});
// get document type details
scope.mediaType = scope.node.contentType;
// get node url
scope.nodeUrl = scope.node.mediaLink;
// make sure dates are formatted to the user's locale
formatDatesToLocal();
}
@@ -30,7 +41,7 @@
var url = "/settings/mediaTypes/edit/" + mediaType.id;
$location.path(url);
};
// watch for content updates - reload content when node is saved, published etc.
scope.$watch('node.updateDate', function(newValue, oldValue){
if(!newValue) { return; }
@@ -64,4 +75,4 @@
angular.module('umbraco.directives').directive('umbMediaNodeInfo', MediaNodeInfoDirective);
})();
})();