You need to sign in to do that
Don't have an account?

Access Custom Object Permissions
Hi All,
I'm trying to validate that an user have the correct object permissions to correctly use my application.
I was searching everywhere and I couldn't find a possible solution... I'm looking for the information store in the section "Custom Object Permissions" at a Profile Detail.
I think my main issue is that I want to validate other users but logged in with the System Admin. I thought about try/catch the dml and determinate the permissions, but this only works with the context user, and runAs only works inside Test Methods, so, that won't work for me.
I wonder if someone try to do this or figured out some work around to determinate the object permissions.
Thanks in advance,
J.
That data is available in the sObject describe data, albeit with different names.
Take a look at the documentation here: http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_methods_system_sobject_describe.htm?SearchType=Stem\
The short version is you can do something like this:
sObject yourCustomObj = [something];
boolean reable = yourCustomObj.getObjectType().getDescribe().isQueryable();
Thanks for the reply.
I already know that, but doesn't work in my case because this only help me with the currently logged user, and i want to find out the permissions of several users with my system admin.
Regards,
J.
You can always do those checks from inside a System.RunAs block. You're limited on the number you can run per apex invocation, but the limit should be high enough to test for most profiles in your org.