Branches in Application
Before exploitation Branches, you must configure the list of Branch types, assign users to the Branches and to distribute the Permissions.
XafariBCBranchesCfgModule provides a viewing and configuring the Branches at runtime. It is provided by the Xafari.BC.Branches.Cfg.dll assembly. There are 2 strategies for the use of this module:
- Add module to the business application. In this case, the administration function will be available in the target application.
- The target business application is developed based on the use of a separate administration tool - Xafari Applications Support (XAS). This is used in the present example.
Table of content:
- Type Settings
- Branches Administration
- Assign User to Branches
- User Interaction with the Branch Objects
Type Settings
XafariBCBranchesCfgModule adds Branches group to the Navigation Items, the group contains Branches and Branch settings items.
Branch settings item activate Detail View with the list of types that support Branches, i.e. these types implements IBranchSupport interface, see Getting Started. The types are displayed on the left side, focused type is displayed on the Detail View on the right side, among other things, this displays the aggregated types.
Service Enabled option enables or disables Branches for the whole application.
Read Mode option is relevant for users who have access to several Branches, it is described in the Learn More topic.
Set Service Enabled property to the "Yes" value and Read Mode property to the "Current branch" value.
To activate Branches for the focused type, set Is Branch Enabled property to the "Yes" value.
Branches Administration
Branches item activate Detail View with Branches list, it provides a viewing and editing of the Branches.
Assign User to Branches
Next, you need to provide Users with access to Branches. This procedure is similar to assigning a User to a Roles.
Invoke User Detail View and activate Branch items tab.
Execute New Action, in the invoked Branch Item Detail View specify Branch and Permission properties. You can select existing Branch from lookup list or create a new once. The Permisiion value may be "Read" or "Write".
Save changes.
To examine Branches Permissions in details, refer to the Learn More topic.
After configuring the Branches is completed, restart the application for the settings to take effect.
User Interaction with the Branch Objects
Now, after authorization the system will display a View with a list of available Branches.
After loading the app, the status bar will show the current Branch for the authorized user.
Now, if the User will create the object that supports the Branches, this object will be automatically attached to the current Branch. Of course, provided that the user has Write-permissions for the current Branch.
As for the already existing objects that supports the Branches, the User can see objects of all available Branches or only the current one. This is determined by the Read Mode option (see Learn More).
Note
If the User has Administrator Permissions, then the Branches restrictions will have no effect. The Administrator can view and edit the data of any Branch. This behavior is due to the fact that the service is based on the DevExpress XAF security system.