You need to sign in to do that
Don't have an account?
MoDiggity
Accessing "Manage Public Templates" Profile Permission in Apex
Hi There,
When setting up a profile, there is a checkbox labeled "Manage Public Templates". This controls access to email templates. When set to true, the user has access to modify read-only email folders, and edit and add templates to those folders.
I have an VF page that allows users to add, edit, and delete email templates. Within apex, users who shouldn't be allowed to, are able to delete and edit records to which they have no access.
What I need to do is control access programmatically. However, I cannot figure out how to access the "Manage Public Templates" setting with code. I am looking in the PermissionSet using the user's profile Id. I can get all the other settings.
If you're familiar with this object (PermissionSet), you know that each setting has it's own column in the table called permissions[permission name], so for instance:
[select PermissionsEditHtmlTemplates, PermissionsAPIEnabled from PermissionSet where ProfileId = : UserInfo.getProfileId()]
Would give you the settings for the profile of the logged in user.
However, I don't know which of these "settings" corresponds to the "ManagePublicTemplates" setting.
I know for sure that PermissionsEmailTemplateManagement is NOT it. Neither is PermissionsManageEmailClientConfig. Neither is PermissionsEditHtmlTemplates.
Any ideas how I can access this setting? I need to see it in my Apex code.
Thank you.
When setting up a profile, there is a checkbox labeled "Manage Public Templates". This controls access to email templates. When set to true, the user has access to modify read-only email folders, and edit and add templates to those folders.
I have an VF page that allows users to add, edit, and delete email templates. Within apex, users who shouldn't be allowed to, are able to delete and edit records to which they have no access.
What I need to do is control access programmatically. However, I cannot figure out how to access the "Manage Public Templates" setting with code. I am looking in the PermissionSet using the user's profile Id. I can get all the other settings.
If you're familiar with this object (PermissionSet), you know that each setting has it's own column in the table called permissions[permission name], so for instance:
[select PermissionsEditHtmlTemplates, PermissionsAPIEnabled from PermissionSet where ProfileId = : UserInfo.getProfileId()]
Would give you the settings for the profile of the logged in user.
However, I don't know which of these "settings" corresponds to the "ManagePublicTemplates" setting.
I know for sure that PermissionsEmailTemplateManagement is NOT it. Neither is PermissionsManageEmailClientConfig. Neither is PermissionsEditHtmlTemplates.
Any ideas how I can access this setting? I need to see it in my Apex code.
Thank you.
Please refer to this link below for creating Apex Managed Sharing to Create Custom Record Sharing-
https://developer.salesforce.com/page/Using_Apex_Managed_Sharing_to_Create_Custom_Record_Sharing_Logic
Try this. Hope it helps.
1: if the folder's access level is set to Read / Write, then anybody can write to it
2: if the folder's access level is set to Read only, users who are members of a profile / permission set that has the "Manage Public Templates" setting checked can still create email templates and edit existing ones in that folder.
I tried using the UserRecordAccess table on the folder object but that didn't return anything useful. I can use the Folder object's "IsReadOnly" property to see if the folder is read only, but if the current user has "Manage Public Templates" in their profile, that doesn't matter. They are still able to edit and create templates in these folders.