Make some articles public and others require authentication without roles

Shawn Dowler
Tera Guru

I have a use case to make it so some knowledge articles are public and can be viewed by unauthenticated users while other articles could be visible to authenticated users who have no roles. I have found that if I give the article no roles or the public role, then the article is only visible to authenticated users. If I add the kb_view.do page to Public Pages, then unathenticated users can read articles without the public role. Essentially, it's as if the public role does nothing.

I feel like I'm missing something somewhere. Any help in the right direction would be appreciated.

1 ACCEPTED SOLUTION

Hi Shawn,



Have you tried a before business rule to filter out articles for non logged in users?



Perhaps combine that with a "No login required" checkbox to make the filtering easy.



something like:



function onBefore(current, previous) {


    current.addQuery("u_no_login_required", true);


}



with a condition of:



!gs.isLoggedIn();



It's not using roles, but was working nicely for me.



Cheers


R


View solution in original post

5 REPLIES 5

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Shawn Dowler



A limited number of pages are public so that users need not log in to view them such as welcome page,login and logout pages. However for other pages to make it public you have to add it in the public pages.


We have the Public Pages module already installed, but I was hoping to be able to have something like the following:



Article RoleAccess
knowledgeOnly users with knowledge role
<none>Only authenticated users
publicDoes not require authentication (anyone with the link can view)


But when I have kb_view.do inactive in the Public Pages module, then unauthenticated users have to log in to be able to view articles that have either no roles or with the public role. If I make kb_view.do active, then unauthenticated users do not have to log in to see the contents of KB Articles that have either no roles or with the public role.



I was hoping that articles without a role would require users to log in, while articles with the public role would not require users to log in. Is there any way to get that kind of functionality? I know it's a very specific requirement. We have many users without roles who should see articles, but which should not be open to the whole Internet. We have other articles, though, which should be open to the whole Internet.



Thanks.


Hi Shawn,



Have you tried a before business rule to filter out articles for non logged in users?



Perhaps combine that with a "No login required" checkbox to make the filtering easy.



something like:



function onBefore(current, previous) {


    current.addQuery("u_no_login_required", true);


}



with a condition of:



!gs.isLoggedIn();



It's not using roles, but was working nicely for me.



Cheers


R


I have been working on this offline and decided on Mark Stanger's solution at his web site. It's called » Controlling Public Availability of Knowledge Base Content and his solution is similar to yours.