Summary: There are cases when you need users to provide attribute values in a certain format. The attribute format can be enforced with Cayosoft Administrator 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.
ID: KB20180704-1
In this article:
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
-
Open the Cayosoft Administrator console
-
Navigate to Home > 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" - see Picture 1 below
-
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 Office Phone attribute
-
Select it in the list
-
Click Edit Policy - see Picture 2 below
-
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
Picture 1
Picture 2
How to enforce format for phone number with optional extension number
In this example we will configure 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
How to enforce prefix for Distribution Group names
In this example we will configure Attribute Policy that defines the Distribution Group Prefix format as "DL_"
-
Open the Cayosoft Administrator console
-
Navigate to Home > 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 - see Picture 5 below
-
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
-
Select it in the list
-
Click Edit Policy - see Picture 6 below
-
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
Picture 5
Picture 6
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-on Web Portal
- Search for any existing user or create a new one
- Open user properties
- Click Contact tab
- Type Office Phone as "12345"
- You will see the error message and red exclaim sign on the Contact tab - see Picture 3
- Now type the Phone Number as +1 1234567890 - no errors, see Picture 4
- Click Update user properties
Picture 3
Picture 4
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
-
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 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:
|
+1 1234567890 |
([0-9]{3}\s[0-9]{3}-[0-9]{4})(\sx[0-9]{4})? | Phone Number must have:
Phone Number may have extension:
|
111 222-3333 x1234 |
[a-z0-9_-]{3,16} |
User name must be in following format:
|
aarturo79 |
([a-z0-9]+)@([\da-z]+)\.([a-z]{2,6}) |
User email address must be in following format:
|
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 |
Related Articles
Regular Expression Language - Quick Reference (Microsoft Docs)
Uniqness names generation in Attribute Policy
Comments
0 comments
Please sign in to leave a comment.