Created
June 5, 2018 10:19
-
-
Save nathanwoulfe/d7e880e83e21d3614e5847caaa972203 to your computer and use it in GitHub Desktop.
Hide the unpublish button for members of the editor group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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