Article

coolguys's picture
article
Reads:

3262

Score:
0
0
 
Comments:

0

Selectively Placing Users, from Flat to Hierarchical

(View Disclaimer)

Problem

Here's an example of how to create a placement rule that places users from a flat structure, depending on whats in the user's attribute OU(Department), into a hierarchical structure in the Production Tree.

Solution

From Policy Builder:

If class name equal case insensitive User
and if source attribute department equal case insensitive "value of 
department attribute"
set operation destination DN " ou path structure you would like" + "\" + 
escape destination DN()operation attribute("CN")

With a series of these placement rules, you can get everyone in the proper ou, provided their department attribute is properly valued.

Here is the code excerpt taken from the exported driver. There are three cases: staff, xstaff and guest; the operative attr is lblempstat.

<rule name="PublisherPlacementRule">
	<policy>
		<rule>
			<description>guest</description>
			<conditions>
				<and>
					<if-class-name op="equal">User</if-class-name>
					<if-src-attr name="lblEmpStat" op="equal">guest</if-src-attr>
				</and>
			</conditions>
			<actions>
				<do-set-op-dest-dn>
					<arg-dn>
						<token-text xml:space="preserve">LBNL\People\Guest</token-text>
						<token-text xml:space="preserve">\</token-text>
						<token-escape-for-dest-dn>
							<token-op-attr name="CN"/>
						</token-escape-for-dest-dn>
					</arg-dn>
				</do-set-op-dest-dn>
			</actions>
		</rule>
		<rule>
			<description>Staff</description>
			<conditions>
				<and>
					<if-class-name op="equal">User</if-class-name>
					<if-src-attr name="lblEmpStat" op="equal">staff</if-src-attr>
				</and>
			</conditions>
			<actions>
				<do-set-op-dest-dn>
					<arg-dn>
						<token-text xml:space="preserve">LBNL\People\Staff</token-text>
						<token-text xml:space="preserve">\</token-text>
						<token-escape-for-dest-dn>
							<token-op-attr name="CN"/>
						</token-escape-for-dest-dn>
					</arg-dn>
				</do-set-op-dest-dn>
			</actions>
		</rule>
		<rule>
			<description>xstaff </description>
			<conditions>
				<and>
					<if-class-name op="equal">User</if-class-name>
					<if-src-attr name="lblEmpStat" op="equal">xstaff</if-src-attr>
				</and>
			</conditions>
			<actions>
				<do-set-op-dest-dn>
					<arg-dn>
						<token-text xml:space="preserve">LBNL\People\XStaff</token-text>
						<token-text xml:space="preserve">\</token-text>
						<token-escape-for-dest-dn>
							<token-op-attr name="CN"/>
						</token-escape-for-dest-dn>
					</arg-dn>
				</do-set-op-dest-dn>
			</actions>
		</rule>
	</policy>
</rule>

Disclaimer: As with everything else at Cool Solutions, this content is definitely not supported by Novell (so don't even think of calling Support if you try something and it blows up).

It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test, test, test before you do anything drastic with it.




User Comments

© 2013 Novell