How to hide/disable "Add Comment" section in Asset Timeline
I have a required to hide/disable comment section in the asset timeline for a particular user group? Any advice on how can this be achieved?
I have a required to hide/disable comment section in the asset timeline for a particular user group? Any advice on how can this be achieved?
One of the ways to customise this would be to :
1. Get the current userGroups and check if they fall in the group for which commenting should not be allowed. Lets, assume the variable as isUnallowedUg.
function getLoggedInUserID() {
var currentUserId = "";
var currentUserInfo;
var CURRENT_USER_JSON_PATH = Granite.HTTP.externalize('/libs/granite/security/currentuser.json');
var result = Granite.$.ajax({
type: "GET",
async: false,
url: CURRENT_USER_JSON_PATH
});
if (result.status === 200) {
currentUserInfo = JSON.parse(result.responseText);
currentUserId = currentUserInfo.authorizableId;
}
return currentUserId;
}
function getUserGroups(userID)
var isMemberOfGroupEveryOne=false;
$.ajax({
url: "/bin/security/authorizables.json?filter=" + userID +'&_charset_=utf-8',
async: false,
success: function(result) {
if (result) {
$.each(result.authorizables,function(index,authObj){
if( (authObj.id !== userID)){
return;
}else {
$.each(authObj.memberOf,function(index,memberOf){
if(memberOf.id === 'everyone'){
isMemberOfGroupEveryOne=true;
}
});
}
});
}
}
});
return isMemberOfGroupEveryOne;
}
I have used everyone for demo, you could use your custom group.
2. if isUnallowedUg is true, you would be hiding the class cq-common-admin-timeline-toolbar using display: none in CSS.
Hope this helps, thanks!
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.