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

Is it possible to get a standard users permissions on Custom Objects ..?
Hello everybody ,
I am having a Situation to get the object level permissions(like modify ,delete ,etc) of a standard user on custom objects in controller , can anybody have the idea how to acheive this?
You can check the permissions for loggedin User within your controller by using :
Schema.sObjectType.Contact.isCreateable()
and for fields:
Schema.sObjectType.Contact.fields.Email.isAccessible()
Thanks GreatG for your quick reply ,
Your solution is good enough to know only for the current User .
But in our requirement .. we have a User lookup field , and for the selected standard user we need to know these Object level permissions.
Thanks once agian for your solution.
You need to make query on Profile
For your reference
SELECT Name,PermissionsAllowUniversalSearch,PermissionsAllowViewKnowledge,PermissionsApiEnabled,PermissionsAuthorApex,PermissionsBulkApiHardDelete,PermissionsCanInsertFeedSystemFields,PermissionsCanUseNewDashboardBuilder,PermissionsChatterFileLink,PermissionsConnectOrgToEnvironmentHub,PermissionsConvertLeads,PermissionsCreateMultiforce,PermissionsCustomizeApplication,PermissionsCustomSidebarOnAllPages,PermissionsDelegatedPortalUserAdmin,PermissionsDistributeFromPersWksp,PermissionsEditCaseComments,PermissionsEditEvent,PermissionsEditKnowledge,PermissionsEditOppLineItemUnitPrice,PermissionsEditPublicDocuments,PermissionsEditReadonlyFields,PermissionsEditReports,PermissionsEditTask,PermissionsEmailAdministration,PermissionsEmailTemplateManagement,PermissionsEnableNotifications,PermissionsFlowUFLRequired,PermissionsIdentityConnect,PermissionsImportLeads,PermissionsInstallMultiforce,PermissionsIPRestrictRequests,PermissionsManageAnalyticSnapshots,PermissionsManageAuthProviders,PermissionsManageBusinessHourHolidays,PermissionsManageCallCenters,PermissionsManageCases,PermissionsManageCategories,PermissionsManageChatterMessages,PermissionsManageCssUsers,PermissionsManageCustomReportTypes,PermissionsManageDashboards,PermissionsManageDataCategories,PermissionsManageDataIntegrations,PermissionsManageDynamicDashboards,PermissionsManageEmailClientConfig,PermissionsManageEntitlements,PermissionsManageInteraction,PermissionsManageKnowledge,PermissionsManageKnowledgeImportExport,PermissionsManageLeads,PermissionsManageMobile,PermissionsManagePartnerNetConn,PermissionsManagePartners,PermissionsManageQuotas,PermissionsManageRemoteAccess,PermissionsManageSelfService,PermissionsManageSolutions,PermissionsManageSynonyms,PermissionsManageUsers,PermissionsMassInlineEdit,PermissionsModifyAllData,PermissionsNewReportBuilder,PermissionsOverrideForecasts,PermissionsPasswordNeverExpires,PermissionsPortalSuperUser,PermissionsPublishMultiforce,PermissionsResetPasswords,PermissionsRunFlow,PermissionsRunReports,PermissionsSalesConsole,PermissionsScheduleReports,PermissionsSendSitRequests,PermissionsSolutionImport,PermissionsTagManager,PermissionsTransferAnyCase,PermissionsTransferAnyEntity,PermissionsTransferAnyLead,PermissionsUseTeamReassignWizards,PermissionsViewAllData,PermissionsViewAllForecasts,PermissionsViewDataCategories,PermissionsViewMyTeamsDashboards,PermissionsViewSetup,SystemModstamp,UserLicenseId,UserType FROM Profile
@asish1989
Dear asish thanks for your reply ,
Can u please explain me in detail what steps to follow after quering the profile .
Hi
See, user and profile are related by profileid.
Do one thing, Please go through these link
http://blogs.developerforce.com/engineering/2012/06/using-soql-to-determine-your-users-permissions-2.html
http://salesforce.stackexchange.com/questions/3800/how-to-access-profile-permissions-via-api
Also go through these link
http://www.salesforce.com/us/developer/docs/apexcode/index_Left.htm#StartTopic=Content/apex_classes_perms_enforcing.htm#kanchor431
http://boards.developerforce.com/t5/Apex-Code-Development/UserRecordAccess-query-problem/td-p/707411
Hello EveryOne ,
Is to possible to Edit a custom object permissions in custom profile from the controller ???
Dml Operations are not allowed in Profile. You only can see permission of particular object in a custom profile.
Suppose there is Custom Object named Book
You can make query like this
ObjectPermissions testObjectPermissions = [SELECT Id, SObjectType, PermissionsRead, PermissionsCreate
FROM ObjectPermissions
WHERE parentid in (select id from permissionset where
PermissionSet.Profile.Name = 'Recruiter') AND SObjectType = Book]
System.debug('Printing ---->'+testObjectPermissions );
Here Recruiter is custom profile name.Book is custom Object name.
Here is some link you can refer
http://www.salesforce.com/us/developer/docs/api/index_Left.htm#StartTopic=Content/sforce_api_objects_permissionset.htm