Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

W-17568988 Wr/decompose ps2 custom perm #1483

Merged
merged 2 commits into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
test: add snapshot test, passing now, should fail
  • Loading branch information
WillieRuemmele committed Jan 10, 2025
commit e8e31d997230abc3357eaba46258f0c7bdd0161d
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export class DecomposedPermissionSetTransformer extends BaseMetadataTransformer
return [...writeInfosForChildren, ...writeInfoForParent];
}
}
/** for a component, parse the xml and create an json object with contents, child typeId, etc */
/** for a component, parse the xml and create a json object with contents, child typeId, etc */
const getComposedMetadataEntries = async (component: SourceComponent): Promise<ComposedMetadata[]> =>
// composedMetadata might be undefined if you call toSourceFormat() from a non-source-backed Component
Object.entries((await component.parseXml())[component.type.name] ?? {}).map(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet>
<applicationVisibilities>
<application>withCustomPermission</application>
<visible>true</visible>
</applicationVisibilities>
</PermissionSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet>
<classAccesses>
<apexClass>PagedResult</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>PropertyController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>SampleDataController</apexClass>
<enabled>true</enabled>
</classAccesses>
</PermissionSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet>
<>
<enabled>true</enabled>
<name>myCustomPerm</name>
</>
<>
<enabled>true</enabled>
<name>myCustomPerm1</name>
</>
</PermissionSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<hasActivationRequired>false</hasActivationRequired>
<label>withCustomPermission</label>
</PermissionSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet>
<applicationVisibilities>
<application>withCustomPermission</application>
<visible>true</visible>
</applicationVisibilities>
</PermissionSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet>
<classAccesses>
<apexClass>PagedResult</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>PropertyController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>SampleDataController</apexClass>
<enabled>true</enabled>
</classAccesses>
</PermissionSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet>
<>
<enabled>true</enabled>
<name>myCustomPerm</name>
</>
<>
<enabled>true</enabled>
<name>myCustomPerm1</name>
</>
</PermissionSet>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<hasActivationRequired>false</hasActivationRequired>
<label>withCustomPermission</label>
</PermissionSet>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<members>dreamhouse</members>
<members>ebikes</members>
<members>noObjectSettings</members>
<members>withCustomPermission</members>
<name>PermissionSet</name>
</types>
<version>60.0</version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<applicationVisibilities>
<application>withCustomPermission</application>
<visible>true</visible>
</applicationVisibilities>
<classAccesses>
<apexClass>PagedResult</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>PropertyController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>SampleDataController</apexClass>
<enabled>true</enabled>
</classAccesses>
<>
<enabled>true</enabled>
<name>myCustomPerm</name>
</>
<>
<enabled>true</enabled>
<name>myCustomPerm1</name>
</>
<hasActivationRequired>false</hasActivationRequired>
<label>withCustomPermission</label>
</PermissionSet>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<members>ebikes</members>
<members>dreamhouse</members>
<members>noObjectSettings</members>
<members>withCustomPermission</members>
<name>PermissionSet</name>
</types>
<version>59.0</version>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata">
<applicationVisibilities>
<application>withCustomPermission</application>
<visible>true</visible>
</applicationVisibilities>
<classAccesses>
<apexClass>PagedResult</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>PropertyController</apexClass>
<enabled>true</enabled>
</classAccesses>
<classAccesses>
<apexClass>SampleDataController</apexClass>
<enabled>true</enabled>
</classAccesses>
<customPermissions>
<enabled>true</enabled>
<name>myCustomPerm</name>
</customPermissions>
<customPermissions>
<enabled>true</enabled>
<name>myCustomPerm1</name>
</customPermissions>
<hasActivationRequired>false</hasActivationRequired>
<label>withCustomPermission</label>
</PermissionSet>
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,27 @@ describe('fully decomposed permission set via decomposePermissionSetBeta2', () =
fs.promises.readFile(path.join(testDir, MDAPI_OUT, 'permissionsets', 'ebikes.permissionset'), 'utf8'),
]);
compareTwoXml(old2, updated2);

const [old3, updated3] = await Promise.all([
fs.promises.readFile(
path.join(testDir, 'originalMdapi', 'permissionsets', 'noObjectSettings.permissionset'),
'utf8'
),
fs.promises.readFile(path.join(testDir, MDAPI_OUT, 'permissionsets', 'noObjectSettings.permissionset'), 'utf8'),
]);
compareTwoXml(old3, updated3);

const [old4, updated4] = await Promise.all([
fs.promises.readFile(
path.join(testDir, 'originalMdapi', 'permissionsets', 'withCustomPermission.permissionset'),
'utf8'
),
fs.promises.readFile(
path.join(testDir, MDAPI_OUT, 'permissionsets', 'withCustomPermission.permissionset'),
'utf8'
),
]);
compareTwoXml(old4, updated4);
});

after(async () => {
Expand Down