Norman
_obf=field1, field2 is excellent however I would like to be able to toggle it on and off using a button. Would that be possible?
Pete
Norman
Pete
Hi Pete
My apologies I misread your post Norm was talking about adding it to dev tools and then using a key press to show certain things. Are you wanting to do toggle obf for Page/ View/ Fields?
Craig
Craig, something I can do like this
$(document).on(‘knack-scene-render.scene_222’, function(event, scene) {
if(Knack.getUserRoles(‘object_57’)==false)
{
Obfuscate fields that are tagged
}
else
{
Clear obfuscation flag
}
})
Does this make sense?
I know I can set up to different views but this is cumbersome when you have a lot of views to manage.
Pete
Hi Pete
Yes it does make sense and yes this is possible. How are you tagging the fields?
You could either have an array of fields in your code.
or
You could use _cls with ktlTarget and ktlRoles so the class is only applied to the fields specified for certain user roles. Or not applied for certain roles.
I think I’d prefer to use the _cls that way you only need a couple of lines of code and the KTL takes care of the rest.
Then when ever the code finds the class you can obfuscate that field.
Let me know what you think you’d prefer to do and I’ll send you some code in the morning.
Craig
Craig
I have been using _obf=field but while this can obfuscate I cannot turn the obfuscation off dynamically and currently have to use two views, one for those who can read and one for those who cannot.
Happy to use whatever you feel is best method.
Thanks again.
Pete
Hi Pete
It is dynamic for user Roles you don’t need different views.
_obf=[field_xxxx], [ktlRoles, Supervisor, !Developer]
This would Obfuscate for Supervisor and not developers.
Craig
Hi @Peter2,
I will soon have a method to toggle this feature quickly on/off with a single button click.
You should subscribe to the KTL Changelog here to get all the updates and know when it’s ready:
KTL Changelog - please subscribe to see all updates! · cortexrd/Knack-Toolkit-Library · Discussion #47 (github.com)
Cheers,
Norm