Demos using User Criteria and Article-level access control in the Knowledge Base
We have two great videos to help understand security configuration for Knowledge Management
Knowledge Management v3 (all releases Fuji and beyond) uses User Criteria to define access control at the Knowledge Base level. This video introduces the concepts and demostrates how to configure User Criteria
In order to achieve Article-level access control, you can refer to our blog Article Security and Filtering in Knowledge v3 on this topic. The video below walks through a use case to explain this even further.
The script referred to in the second video is below
// customer would have added a field called 'u_location'
// (instead of checking an article list)
// and each article might have this field that can be checked
// against the user's location
//
// Exceptions: users with role 'admin' or 'knowledge_admin' or 'knowledge_manager'
// will be able to see all article (not restricted by location)
function onBefore(current, previous) {
//This function will be automatically called when this rule is processed
var userObj = gs.getUser();
if(!userObj.hasRole("admin") && !userObj.hasRole("knowledge_admin") && !userObj.hasRole("knowledge_manager")) {
var gr = new GlideRecord("sys_user");
gr.get(gs.getUserID());
var currentUserLocation = gr.location.country;
var q=current.addNullQuery('u_location');
q.addOrCondition('u_location', currentUserLocation);
gs.print("Query restricted to location: " + currentUserLocation);
}
}
https://www.servicenow.com/community/now-platform-blog/demos-using-user-criteria-and-article-level-access-control-in/ba-p/2290131