-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Added features for permission-based recipe #322
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...app/main/default/customPermissions/accessRestrictedUIPermission.customPermission-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<CustomPermission xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<description | ||
>For use in toggling UI features in the wireCustomPermission recipe.</description> | ||
<label>Access Restricted UI Permission</label> | ||
</CustomPermission> |
18 changes: 18 additions & 0 deletions
18
force-app/main/default/lwc/miscPermissionBasedUI/miscPermissionBasedUI.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<template> | ||
<lightning-card title="MiscPermissionBasedUI" icon-name="custom:custom77"> | ||
<div class="slds-var-m-around_medium"> | ||
<template if:true={isRestrictedUIAccessible}> | ||
<p>The permission set is assigned</p> | ||
</template> | ||
<template if:false={isRestrictedUIAccessible}> | ||
<p>The permission set is not assigned</p> | ||
</template> | ||
</div> | ||
<c-view-source source="lwc/miscPermissionBasedUI" slot="footer"> | ||
Use custom permission to conditionally render UI. To change the | ||
rendered UI assign the | ||
<strong>Access_Restricted_UI</strong> permission set to this user | ||
and refresh the page. | ||
</c-view-source> | ||
</lightning-card> | ||
</template> |
12 changes: 12 additions & 0 deletions
12
force-app/main/default/lwc/miscPermissionBasedUI/miscPermissionBasedUI.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
// import the permission from userPermission (standard Salesforce permissions) or | ||
// customPermission (custom org-defined permissions) | ||
import hasAccessRestrictedUI from '@salesforce/customPermission/accessRestrictedUIPermission'; | ||
|
||
export default class MiscPermissionBasedUI extends LightningElement { | ||
// surface imported permission to HTML template with getter | ||
get isRestrictedUIAccessible() { | ||
return hasAccessRestrictedUI; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
force-app/main/default/lwc/miscPermissionBasedUI/miscPermissionBasedUI.js-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<apiVersion>49.0</apiVersion> | ||
<isExposed>true</isExposed> | ||
<targets> | ||
<target>lightning__AppPage</target> | ||
<target>lightning__RecordPage</target> | ||
<target>lightning__HomePage</target> | ||
</targets> | ||
</LightningComponentBundle> |
9 changes: 9 additions & 0 deletions
9
force-app/main/default/permissionsets/Access_Restricted_UI.permissionset-meta.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<PermissionSet xmlns="http://soap.sforce.com/2006/04/metadata"> | ||
<customPermissions> | ||
<enabled>true</enabled> | ||
<name>accessRestrictedUIPermission</name> | ||
</customPermissions> | ||
<hasActivationRequired>false</hasActivationRequired> | ||
<label>Access_Restricted_UI</label> | ||
</PermissionSet> |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Across all recipes we set all three targets: App, Home, and Record.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this. But I'd like to ask: why?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Simple showcase on how to set multiple targets. Also enables the learner to easily use/play with any of the components on any of the most relevant LEX experiences.