Summary: There are cases when you need users to provide attribute values in a certain format. The attribute format can be enforced with the Attribute Policy through the Mask setting. The mask is a regular expression that determines how the data must be entered by the user.
Applies to: Cayosoft Administrator 5.2 or later.
How to enforce Office Phone attribute format with mask
In this example, we will configure the Attribute Policy that defines the user office phone format as +1 1234567890.
In the Cayosoft Administrator console, navigate to Configuration > Web Portal > Attribute Policies.
Click the button Add Attribute Policy in the upper right corner.
Enter the name of the new policy, then expand the Policy Details.
Click Add in the Policy Scope section.
-
In the Specify Policy Scope dialog, select Active Directory in the first column Admin Units.
Select AD Users in the second column Web Queries.
Select Properties in the third column Web Actions.
Click OK.
Click the newly created scope to select it.
Search for the Office Phone attribute and select it.
Click Edit Policy.
-
Select Mask check box:
Provide Mask value: \+1\s[0-9]{10}\b
Provide Error text: Phone number must be in the format +1 1234567890
Click OK
Click Save Changes on the policy form.
NOTE: The policy will become active in the Web Portal the next time the page is refreshed or when the user signs on.
How to enforce format for phone number with optional extension number
In this example we will configure the Attribute Policy that defines user's office phone, when the extension number is possible but not forced:
- Perform steps 1-13 from the previous scenario.
- Select Mask check box:
- type in Mask: ([0-9]{3}\s[0-9]{3}-[0-9]{4})(\sx[0-9]{4})?$.
- type in Error text: Phone number must be in the format XXX XXX-XXXX x1234.
- Click OK.
- Click Save Changes on the policy form.
NOTE: The policy will become active in the Web Portal the next time the page is refreshed or when the user signs on.
How to enforce prefix for Distribution Group names
In this example we will configure the Attribute Policy that defines the Distribution Group Prefix format as "DL_"
In the Cayosoft Administrator console, navigate to Configuration > Web Portal > Attribute Policies.
Click the button Add Attribute Policy in the upper right corner.
Enter the name of the new policy, then expand the Policy Details.
Click Add in the Policy Scope section.
In the Specify Policy Scope dialog, select Active Directory in the first column Admin Units.
Select AD Groups in the second column.
-
Select New Distribution Group in the third column Web Actions.
Click OK.
Click the newly created scope to select it.
Search for Group Name attribute.
Click Edit Policy.
-
Select Mask check box:
Provide Mask value:
^DL_.Provide Error text: Group Name prefix must be
DL_.
Click OK.
Click Save Changes on the policy form.
NOTE: The policy will become active in the Web Portal the next time the page is refreshed or when the user signs on.
How to check attribute mask in Web Portal
Suppose, the first scenario is configured, when the office phone number must be +1 1234567890.
- Sign in to the Web Portal.
- Search for any existing user or create a new one.
- Open user properties.
- Click the Contact tab.
- Type Office Phone as 12345.
-
You will see the error message and red exclaim sign on the Contact tab.
-
Now type the Phone Number as +1 1234567890.
- Click Update user properties.
Exclude all "." symbols from the string
Example: exclude all "." symbols from the user's last name.
Create a new Attribute Policy to control new user creation. Learn more in: Attribute policies .
Select Last Name attribute.
Click Edit Policy
-
Select Mask check box:
Provide Mask value:
^[A-Z](?!.*[.].*)Provide Error text: User Last Name cannot contain ".".
Click OK.
Click Save Changes in the policy form.
Find all user accounts whose email starts with a number
Example: Configure a Dynamic Group that will include users whose email starts with a number.
- Create a Dynamic Group .
- Add Membership rule with Include Query type.
- Add the AD Users command.
- Set the Filter AD query results setting to
{$_.mail -match "^\d"}. - Save changes.
Mask Regular Expression (Regex) Examples
| Mask (RegExp) | Description | Example |
|---|---|---|
| \+1\s[0-9]{10}\b |
Phone Number must be in following format: Must start with +1 Followed by space character \s Then 10 digits in sequence [0-9]{10} |
+1 1234567890 |
| ([0-9]{3}\s[0-9]{3}-[0-9]{4})(\sx[0-9]{4})? | Phone Number must have:
3 digits [0-9]{3}
Space character \s
3 digits [0-9]{3}
Dash symbol -
4 digits [0-9]{4}
Phone Number may have extension: Space character \s Letter x 4 digits [0-9]{4} (\sx[0-9]{4})? means that extension is optional |
111 222-3333 x1234 |
| [a-z0-9_-]{3,16} |
User name must be in following format: One or more lower case letter a-z One or more number 0-9 Underscore symbol _ Dash symbol - User name must contain at least 3 of these characters, but not more than 16 {3,16} |
aarturo79 |
| ([a-z0-9]+)@([\da-z]+)\.([a-z]{2,6}) |
User email address must be in following format: One or more lower case letter a-z One or more number 0-9 Et symbol @ One or more number \d One or more lower case letter a-z Dot . One or more lower case letter a-z, at least 2 but not more then 6 {2,6} |
aarturo79@123test.com |
| ^[A-Z](?!.*[.].*) | Exclude all "." symbols from the string. |
AdamArturo |
| ^[A-Z](?!.*[.0-9].*) | Exclude all numbers and the "." character from the string. |
AdamArturo |
| ^\d | A string should start with a number. |
1test@domain.com |
| ^[A-Za-z] | A string should start with a letter. |
test1@domain.com |
Comments
0 comments
Please sign in to leave a comment.