Skip to content

Instantly share code, notes, and snippets.

@nathanwoulfe
Created June 5, 2018 10:19
Show Gist options
  • Save nathanwoulfe/d7e880e83e21d3614e5847caaa972203 to your computer and use it in GitHub Desktop.
Save nathanwoulfe/d7e880e83e21d3614e5847caaa972203 to your computer and use it in GitHub Desktop.
Hide the unpublish button for members of the editor group
/* package.manifest...
*
* {
* "javascript" : ["~/App_Plugins/nunpublish/script.js"]
* }
*/
(function () {
function directive(authResource) {
return {
restrict: 'E',
link: function () {
authResource.getCurrentUser()
.then(function (user) {
if (user.userGroups.indexOf('editor') !== -1) {
document.styleSheets[0].insertRule('[data-element="button-unpublish"] { display: none!important; }');
}
});
}
}
}
angular.module('umbraco.directives').directive('section', ['authResource', directive]);
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment