If you need to assign permissions based on physical location, you can setup Geographic Permissions on your models. One common example is allowing a role to see only those sites located in its own geographic region. Another example is allowing a role to see shipments being routed from a certain region to another certain region.
Address and ModelLink fields on a model can be defined as contributors to geo-permissions. (A model link field can only be a geo-permission contributor if the model-level type is Site or PartnerSite.)
Each field can be selected as FROM, TO or IN contributor. For FROM and TO, these will be required to match the ends of a GeoLanePermission associated with the current role. For IN, these will be required to match a GeoPermission associated with the current role.
You need to follow a few steps to make Geo Permissions to work correctly. The first section below explains how to setup Geo Permissions meta-data on a model and how to assign role types to use geo-permissions on this model. The second section explains how to create all required Geo model instances in the database to give the role instances permissions.
Procedure 4.4. To enable Geo Permissions on a model
Open a .model or .mdf file in model/mdf editor
Select any address and/or model link fields as Geo Permission contributors
Figure 4.3. Geo Permission type can be selected from the drop-down combo box in the Address field details section.
Figure 4.4. Geo Permission type can be selected from the drop-down combo box in the ModelLink field details section.
Please note that ModelLink field's model-level type must be Site or PartnerSite in order to be Geo Permission contributor.
- After selecting one or more field as Geo Permission contributors, you should open and assign geo-permissions to desired role types.
Figure 4.5. Simply checking "By Geo" check box assigns Geo Permissions on the role type.
You must still give the role permission at the action, issue, and view level if applicable.
Procedure 4.5. How to create Geo models for a role type.
In order to give a specific role geo-permissions, we need to start by creating GeoPatternList models. GeoPatternList is a name for a collection of one or many GeoPattern models. Below is an example code part that creates a GeoPatternList with the name "Texas". This GeoPatternList can cover cities, sites and partner sites within Texas.
Now you need to create GeoPattern models for GeoPatternList(Texas).
You can add as many patterns as you want to a list. However, GeoPatternType should be defined while adding a pattern. Supported GeoPattern types are:
Please also note that depending on the GeoPatternType you choose, you should provide the required information.
In order to provide from-to relationship, you need to create GeoLanePattern models. GeoLanePattern model has two fields: fromGeoPatternList and toGeoPatternList. These two fields are references to two GeoPatternLists which define geographic regions
GeoPermission and GeoLanePermission models map role types to GeoPatternLists. GeoPermission defines "IN" relationship while GeoLanePermission defines "FROM-TO" relationship. If the target model has a Site model link with "IN" GeoPermType set then you need to create GeoPermission record which points to a GeoPatternList which includes GeoPattern records of "GeoPatternType.SITE" types.
If the target model has a PartnerSite field with "FROM" and another PartnerSite field with "TO" GeoPermTypes set, then you need to create GeoLanePermission where from and to GeoPatternLists contain "GeoPatternType.PARTNER_SITE" type GeoPattern models.