There are times where you may need to give the ability to manually assign a Web Role via the portal. This method will walk you through on how to list your contacts and toggle a Web Role assignment on or off. First off, this method is going to have you create a new Web Role called Delegated User. This will be the Role to be Assigned and Unassigned. This name can be changed if desired.
A few things to note: Both the name of the Web Role and the Contact query can be adjusted in the Web Template below. The Contact query is set to display all Contacts as assigned by the below N:N relationship. The Web Role that is to be assigned must be also assigned via a N:N relationship to the Portal Admin so that we are not exposing all Web Roles to the Portal Admin User. In both N:N cases below, either can be adjusted to suit your needs, but is designed to give the least amount of access.
- Create N:N relationships
- Create a N:N relationship from the Contact table to the Contact table. This way, we can set which Contacts will be visible to the Portal end user.
- This is for demonstration purposes only and your situation may vary.
- Add this subgrid to a Contact form and add Contact records as needed
- This is for demonstration purposes only and your situation may vary.
- Create Web Role N:N Relationship
- Create a N:N relationship from the Contact table to Web Role table. This way, we can set which Web Roles we’ll give the end user the ability to assign.
This is for demonstration purposes only and your situation may vary. - Add this subgrid to a Contact form and add Web Role created in later step.
- Create a N:N relationship from the Contact table to Web Role table. This way, we can set which Web Roles we’ll give the end user the ability to assign.
- Create a N:N relationship from the Contact table to the Contact table. This way, we can set which Contacts will be visible to the Portal end user.
- Create Site Settings:
- Enable Contact Table
- Name: Webapi/contact/enabled
- Value: true
- Set Contact Fields
- Name: Webapi/contact/fields
- Value: adx_webrole_contact
- Set Inner Error
- Name: Webapi/error/innererror
- Value: true
- Enable Contact Table
- Set Table Permissions
- Contact Permissions
- Name: Administrator Assignable Contacts
- Table Name: Contact (contact)
- Access Type: Contact
- Contact Relationship: Choose your N:N relationship
- Privileges: Read, Append, Append To
- Web Roles: Assign Proper Web Role(s)
- Web Role
- Name: Administrator Assignable Web Roles
- Table Name: Web Role (adx_webrole)
- Access Type: Contact
- Contact Relationship: Choose your N:N relationship
- Privileges: Read, Append, Append To
- Web Roles: Assign Proper Web Role(s)
- Contact Permissions
- Create Web Role
-
- Name: Delegated User
This Web Role name can be changed, but must be updated in the Web Template Fetch Query below.
- Name: Delegated User
-
- Create a Web Template
- Name: Web Role (web api)
- Source:
ATTACHED FILE Web Template section (Lines 1-67)
- Create a new Page Template
- Name: Webrole (webapi)
- Type: Web Template
- Web Template: Webrole (Webapi)
- Table Name: Web Page (adx_webpage)
- Create Web Page
- Name: Web Role
- Page Template: Webrole (webapi)
- Permissions: Assign Proper Web Role(s)
- JS:
ATTACHED FILE Web Page Javascript section (Lines 69-263) - CSS
ATTACHED FILE Web Page CSS section (Lines 265-279)
- In Pages Studio, click Preview | Desktop
- Sign in and Navigate to the Web Role web page
- It should look similar to this with your list of contacts
- Click the button to Change from No to Yes
- You will see the Authorizing User message at the top. The Web Role will be assigned automatically in the background.
- Click the Yes button to change from Yes to No
- You will see the Removing Authorization message at the top. The Web Role will be removed automatically in the background.
I hope this helps solve your particular task.
*This post is locked for comments