Hide Knowledge Article 'Edit' Button

craigclarke
Mega Contributor

The 'Edit' button on the top right of a Knowledge Article is causing confusion.   It seems enabled for ALL users if they have the ability to edit articles in that KB.

Why would a user who is not the author or KB owner be able to edit an article (they already can comment/flag)??

Does anyone know how to only enable this button for the author and KB owner?

find_real_file.png

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

You nailed it Craig. If you have access to edit articles in that KB, then you have access to that button. By default, it does not restrict people to their own articles.



If you choose to modify the UI macro as Deepa suggests, keep in mind that you are modifying an OOB UI macro and it will not be updated in future upgrades. Once you modify it, you own it.


View solution in original post

8 REPLIES 8

Deepa Srivastav
Kilo Sage

Hi Craig,



It's rendered in the ui macro kb_view_common_header_toolbar which is called by the ui macro kb_view_common which is called by the ui page kb_view.



Mark Correct if it solved your issue or hit Like and Helpful if you find my response worthy.


Hi Deepa,



My requirement is like i should limit the Edit button only for Admins. In my case it is hiding Flag Article button also.



In this UI Macro - kb_view_common_header_toolbar
I just added the below condition check



<j:if test="${gs.hasRole('admin')}"> //After adding this line it is hiding both Edit and Flag Article


<j:if test="${showUpdateAction}">


<button id="editArticle" style="margin-left:0.4em;" title="${gs.getMessage('Edit content')}" aria-label="${gs.getMessage('Edit content')}" class="btn btn-default navbar-btn snc-article-header-toolbar-button pull-right">${gs.getMessage("Edit")}</button>


</j:if>


</j:if>



After adding the above piece of code it is hiding both Edit and Flag Article. But i dont want to hide the Flag Article only Edit button should be hided.


ctomasi


Chuck Tomasi
Tera Patron

You nailed it Craig. If you have access to edit articles in that KB, then you have access to that button. By default, it does not restrict people to their own articles.



If you choose to modify the UI macro as Deepa suggests, keep in mind that you are modifying an OOB UI macro and it will not be updated in future upgrades. Once you modify it, you own it.


Thanks Chuck



If I de-activate the current macro and make a copy (new name) with restrictions on the button does the de-activated one get upgraded in future updates?