- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 11:13 AM
Hi all,
How to override the oob KBVersioningSNC script include and add the additional requirement to existing script behavior.
Additional requirement
Category hardware should be visible to Group A members
Category network should be visible to Group B members
Thanks
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 06:59 AM
Hi William,
I see the KB you found, and based on the recommendation there, I would comment out the whole "if" block. As in:
canCheckout: function(current){
if(gs.getProperty('glide.knowman.allow_edit_global_articles')=='false' && this.isArticleReadOnlyBasedOnDomain(current))
return false;
if(this.isExternalArticle(current))
return false;
if(!this._isValidVersion(current))
return false;
if(current.workflow_state!=this.MAJOR_STATE)
return false;
if(this._getCheckedoutRecord(current))
return false;
//If Ownership Group exist but user is not a member
/*
if(this.isValidFieldWithValue(current,this.OWNERSHIP_GROUP)){
if(this.hasAnyElevatedAccess(current) || this.isGroupMemberOrManager(current[this.OWNERSHIP_GROUP]))
return true;
else if(gs.getProperty("glide.knowman.ownership_group.override", "false") == "true" && this.isAuthorOrReviser(current) && this.safeExecute(this._knowledgeHelper.canContribute, current))
return true;
return false;
}else if(!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
return false;
*/
return true;
},
Your script has an "else if" but no prior "if". If you want that last part, then use:
if (!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
return false;
return true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-26-2023 01:30 PM
Hi william08,
That was asked by another here today, you can edit the KBVersioning script include to enhance/override what is in the KBVersioningSNC script include.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 04:32 AM
var KBVersioning = Class.create();
KBVersioning.prototype = Object.extendsObject(KBVersioningSNC, {
canCheckout: function(current) {
if (gs.getProperty('glide.knowman.allow_edit_global_articles') == 'false' && this.isArticleReadOnlyBasedOnDomain(current))
return false;
if (this.isExternalArticle(current))
return false;
if (!this._isValidVersion(current))
return false;
if (current.workflow_state != this.MAJOR_STATE)
return false;
if (this._getCheckedoutRecord(current))
return false;
// //If Ownership Group exist but user is not a member
// if (this.isValidFieldWithValue(current, this.OWNERSHIP_GROUP)) {
// if (this.hasAnyElevatedAccess(current) || this.isGroupMemberOrManager(current[this.OWNERSHIP_GROUP]))
// return true;
else if (gs.getProperty("glide.knowman.ownership_group.override", "false") == "true" && this.isAuthorOrReviser(current) && this.safeExecute(this._knowledgeHelper.canContribute, current))
return true;
return false;
//}
else if (!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
return false;
return true;
},
type: 'KBVersioning'
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 06:59 AM
Hi William,
I see the KB you found, and based on the recommendation there, I would comment out the whole "if" block. As in:
canCheckout: function(current){
if(gs.getProperty('glide.knowman.allow_edit_global_articles')=='false' && this.isArticleReadOnlyBasedOnDomain(current))
return false;
if(this.isExternalArticle(current))
return false;
if(!this._isValidVersion(current))
return false;
if(current.workflow_state!=this.MAJOR_STATE)
return false;
if(this._getCheckedoutRecord(current))
return false;
//If Ownership Group exist but user is not a member
/*
if(this.isValidFieldWithValue(current,this.OWNERSHIP_GROUP)){
if(this.hasAnyElevatedAccess(current) || this.isGroupMemberOrManager(current[this.OWNERSHIP_GROUP]))
return true;
else if(gs.getProperty("glide.knowman.ownership_group.override", "false") == "true" && this.isAuthorOrReviser(current) && this.safeExecute(this._knowledgeHelper.canContribute, current))
return true;
return false;
}else if(!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
return false;
*/
return true;
},
Your script has an "else if" but no prior "if". If you want that last part, then use:
if (!this.hasAnyElevatedAccess(current) && !this.safeExecute(this._knowledgeHelper.canContribute, current))
return false;
return true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2023 12:39 PM
Hi Bert
Thanks a lot for the help