Hello,
Setting the website's
"Access Flags" can be done using
"Custom Properties" from
"IIS" page. The permission flags can be managed using a list of checkboxes on a dialog. The checkboxes state can be set to an IIS attribute called
"accessPolicy" from the
"system.webServer/handlers" section. The flag
"Enable Directory Browsing" option is treated separately, using the
"enabled" attribute from
"system.webServer/directoryBrowse" section.
The
"accessPolicy" attribute must have the following format :
Code: Select all
flags (None, Read, Write, Execute, Source, Script, NoRemoteWrite, NoRemoteRead, NoRemoteExecute, NoRemoteScript)
Each flag value can be collected from the UI by adding on a dialog a checkbox for each one of the above flags (i.e. Read, Write, Execute, etc). To compute the entire “accessPolicy” attribute value you can set an installer property (i.e. ACCESS_FLAGS_VALUES) with the values of the above checkbox properties.
The
"enabled" attribute must be set to “True” or “False” and this can be done by using a checkbox (e. g. “UA_EDBROWSING”) on a dialog. When the checkbox is checked we will set a property (i.e. “BROWSING”) to “True”, otherwise to “False”.
In order to set the flags, you can make the following configuration :
1. In a dialog page create checkboxes for all the permissions you allow the user to set at install time.
2. In each checkbox “Properties” page, the "Value" must be the corresponding flag name followed by "," (e.g. "NoRemoteWrite,"). This is necessary because after setting the checkboxes, when you "compose" the "ACCESS_FLAGS_VALUES" property to set the
"accessPolicy" attribute value, the members must be separated by ",".
3. The “ACCESS_FLAGS_VALUES” property will be set to the above checkbox property values. This means it will be either <empty> or it will be set to a string ending with comma character. So, you must trim the comma from the end of the "ACCESS_FLAGS_VALUES" or – in case the property is empty – set its value to "None". In the attached example we used a
Run Powershell inline script custom action to do the trim or set the property to "None".
Code: Select all
$A_F_Value = AI_GetMsiProperty ACCESS_FLAGS_VALUES
IF ($A_F_Value -ne "")
{$A_F_Value = $A_F_Value.TrimEnd(",")}
ELSE
{$A_F_Value = "None"}
AI_SetMsiProperty ACCESS_FLAGS_VALUES $A_F_Value
4. In the
IIS page, select the website, navigate to
Custom Properties tab in the right pane and add two atribute values: "enabled" attribute from "system.webServer/directoryBrowse" section and "accessPolicy" attribute from "system.webServer/handlers" section:
Section : system.webServer/directoryBrowse
Name : enabled
Type : boolean (True/False)
Value : [BROWSING]
– the property set depending on the "Enable Directory Browsing" checkbox state
Section : system.webServer/handlers
Name : accessPolicy
Type : flags (None, Read, Write, Execute, Source, Script, NoRemoteWrite, NoRemoteRead, NoRemoteExecute, NoRemoteScript)
Value : [ACCESS_FLAGS_VALUES]
Regarding the other problem, to set an IP address or check the
"All unassigned" checkbox in the binding section based on user dialog input, you can create three edit boxes – "HOSTNAME", "TCP_PORT" and "IP_ADDRESS", populated from the dialog page. On the same page, you create a checkbox with the property "UNASSIGNED", corresponding to the
"All unassigned" option. On the
"Next" button of this dialog you should create a published control event –
"Set installer property value" which will set the "IP_ADDRESS" property to the <empty> value if "UNASSIGNED" checkbox is checked.
In the "IIS" page, select the website, navigate to
"Bindings/SSL" section in the right pane and add a
"New HTTP Binding", as follows :
Hostname: [HOSTNAME]
Port Number: [TCP_PORT]
IP Address: [IP_ADDRESS]
If the "IP_ADDRESS" will be empty, the
"All unassigned" option will be automatically set at install time by Advanced Installer.
Please find attached a sample project which implements these settings.
If you have any questions or doubts just let us know.
All the best,
Daniel
FOLLOW US
Get the latest news in Application Packaging