diff --git a/frontend/app/index.html b/frontend/app/index.html index 9d256a7311..8c04e0f296 100644 --- a/frontend/app/index.html +++ b/frontend/app/index.html @@ -207,6 +207,7 @@ + diff --git a/frontend/app/scripts/components/sharing/SharingListCmp.js b/frontend/app/scripts/components/sharing/SharingListCmp.js index 41679b28e8..1e24b5cf9b 100644 --- a/frontend/app/scripts/components/sharing/SharingListCmp.js +++ b/frontend/app/scripts/components/sharing/SharingListCmp.js @@ -26,7 +26,8 @@ readOnly: '<', //onReload: '&', onUpdateProfile: '&', - onDelete: '&' + onDelete: '&', + permissions: '=' } }); })(); diff --git a/frontend/app/scripts/directives/if-not-permission.js b/frontend/app/scripts/directives/if-not-permission.js new file mode 100644 index 0000000000..090586680c --- /dev/null +++ b/frontend/app/scripts/directives/if-not-permission.js @@ -0,0 +1,24 @@ +(function() { + 'use strict'; + angular.module('theHiveDirectives').directive('ifNotPermission', function(AuthenticationSrv, SecuritySrv) { + return { + restrict: 'A', + scope: false, + link: function(scope, element, attrs) { + var restrictedPermissions = _.map((attrs.ifNotPermission || '').split(','), function(item){ + return s.trim(item); + }); + + if(attrs.allowed !== undefined) { + // Check the list of specified allowed permissions + if(SecuritySrv.checkPermissions(restrictedPermissions, attrs.allowed)) { + element.remove(); + } + } else if(AuthenticationSrv.hasPermission(restrictedPermissions)){ + // Check the user defined permissions + element.remove(); + } + } + }; + }); +})(); diff --git a/frontend/app/views/components/sharing/sharing-list.html b/frontend/app/views/components/sharing/sharing-list.html index 24c07128f1..d45717103b 100644 --- a/frontend/app/views/components/sharing/sharing-list.html +++ b/frontend/app/views/components/sharing/sharing-list.html @@ -9,18 +9,26 @@ Organisation Profile Shared At - Actions + Actions - {{share.organisationName}} + {{share.organisationName}} - {{share.owner}} + + {{share.profileName}} + - + {{share.profileName}} + + {{share.profileName}} + + + + - {{share.profileName}} {{share.createdAt | shortDate}} - - + + Delete diff --git a/frontend/app/views/partials/case/case.sharing.html b/frontend/app/views/partials/case/case.sharing.html index d2a9959831..d0f8bbb0b4 100644 --- a/frontend/app/views/partials/case/case.sharing.html +++ b/frontend/app/views/partials/case/case.sharing.html @@ -1,7 +1,7 @@ -
+
diff --git a/frontend/app/views/partials/observables/details/sharing.html b/frontend/app/views/partials/observables/details/sharing.html index 2cbf8458c1..d3350684dd 100644 --- a/frontend/app/views/partials/observables/details/sharing.html +++ b/frontend/app/views/partials/observables/details/sharing.html @@ -14,6 +14,7 @@

Sharing

shares="shares" read-only="true" on-delete="removeShare(share)" + permissions="userPermissions" >