How to Find a specified user has access permission(read/write) to particular table.

sun_Malaravan
Kilo Contributor

How to check a specified user has access permission(read/write) to particular table.

I am using below code.

var gr = new GlideRecord("incident");

if (!gr.canRead()) {

gs.log("## Insufficient rights to query incident records: ");

}

Above Script doesn't work since canRead() always return "true", even the User doesn't have any Role.

Any thoughts appreciated.

Thanks for your time.

4 REPLIES 4

prdelong
Kilo Guru

You can use GlideRecordSecure if you need to do any kind of scripting. Otherwise I would just open a new browser window (with a new session), turn on security debugging, and impersonate the user in question.


Thank you very much for your suggestion.


I have tried below code.



var att = new GlideRecordSecure('incident');


  att.get('8cbc7b68a4cb55000a476310c119bb73');


  var sm = Packages.com.glide.sys.security.GlideSecurityManager.get();


  var checkMe = 'record/incident/read';


  var canRead= sm.hasRightsTo(checkMe, att);


  gs.log('##My log: ' + canRead);



But this is return always true even the user doesn't have any role / access to incident table. And also i am using Berlin Version.GlideRecordSecure is available starting with the calgary version.



Any thoughts?



Thanks,


Open a new browser window (with a new session), turn on security debugging, and impersonate the user in question.


sun_Malaravan
Kilo Contributor

Thank you very much for your suggestion.


I have tried below code.



var att = new GlideRecordSecure('incident');


  att.get('8cbc7b68a4cb55000a476310c119bb73');


  var sm = Packages.com.glide.sys.security.GlideSecurityManager.get();


  var checkMe = 'record/incident/read';


  var canRead= sm.hasRightsTo(checkMe, att);


  gs.log('##My log: ' + canRead);



But this is return always true even the user doesn't have any role / access to incident table. And also i am using Berlin Version. GlideRecordSecure is available starting with the calgary version.



Any thoughts?



Thanks,