Skip to content

Generate Profile and Permission Sets

Alejandro Ruiz edited this page May 28, 2015 · 1 revision

Problem

It is common that Profiles and PermissionSets are not update according to the changes in a Salesforce project, additionally is dificult to mantain them as of the source code because needs to be retrieved from an organization make them part of the source code which usually brings additional references to elements that are not related to the project source code.

Solution

Provide a mechanism that helps on the process to mantain Profiles and PermissionSets. The idea is provide a way to define metadata information about Profiles and PermissionSets on the source code and use them to generethe the respective Profiles and PermissionSets files. The solution should have the next requirements

  • It should be possible to define the metadata information inside the Object files as a XML comments or put the information in a new file which will only be used by the Enforce plugin.
  • It should be easy and undestable the way to define the metadata information

Metadata notation

It is important to provide a way to make easy to define metadata information, that is why a DSL will be defined which should allow users to define Profiles and PermissionSets in terms of the DSL.

@Profile(Admin, User) {
    @Category__c(ObjectDefaultPermission){
        Description__c(read, edit);
    } 
    @Object1__c(read, edit, delete, viewAll){
        Description__c(read);
        Name__c(FieldDefaultPermission);
    }
    @Object1__c(ObjectSeller){
        Description__c(read);
        Name__c(read);
    }    
}

@Profile(*) {
    @Category__c(ObjectDefaultPermission){
        Description__c(read, edit);
    } 
    @Object1__c(read, edit, delete, viewAll){
        Description__c(read);
        Name__c(FieldDefaultPermission);
    }
    @Object1__c(ObjectSeller){
        Description__c(read);
        Name__c(read);
    }    
}

@PermissionSet(MyPermission, Permission1) {
    @Category__c(ObjectDefaultPermission){
        Description__c(FieldDefaultPermission);
    } 
    @Object1__c(read, edit, delete, viewAll){
        Description__c(read, edit);
        Name__c(read, edit);
    }
}

@PermissionSet(*) {
    @Category__c(ObjectDefaultPermission){
        Description__c(FieldDefaultPermission);
    } 
    @Object1__c(read, edit, delete, viewAll){
        Description__c(read, edit);
        Name__c(read, edit);
    }
}

@TemplatePermission(ObjectDefaultPermission){read, edit, delete, viewAll, modifyAll} 
@TemplatePermission(ObjectSeller){read, viewAll} 
@TemplatePermission(FieldDefaultPermission){read, edit} 
  • Profiles and possible to express the metadata information in terms of new set o

Goal Previous language

... Description__c false Description false false TextArea ...

Current language

Clone this wiki locally