Forum Discussion

Chris_Richards_'s avatar
Chris_Richards_
Icon for Nimbostratus rankNimbostratus
Jan 13, 2016

Set branch based on AD company Value

I'm looking at setting up policy where if the company value is Company A they branch off to one set of resources and if company B they go to a different set of resources.

 

I've found a variable assign rule

 

session.custom.company.role if { ( [mcget {session.ad.last.attr.company}] equals "Company A" )} or equal "Company B"

 

This is set in the properties section but if I want to set 2 different branches for each company how do we alter the rule to do this?

 

Thanks

 

Chris

 

3 Replies

  • You must define 2 branches with expressions:

    • branch Company A

      expr {[mcget {session.ad.last.attr.company}] equals "Company A" }

    • branch Company B

      expr {[mcget {session.ad.last.attr.company}] equals "Company B" }

  • Thanks for the response.

     

    I take it I need to leave the session.custom.company.role if { ( [mcget {session.ad.last.attr.company}] equals "Company A" )} or equal "Company B" In the variable assign properties section? When I leave it blank it complains

     

  • I don't understand why you need to assign value to session.custom.company.role!!!

    if you need it, the expression is:

    session.custom.company.role = 
    if { ( [mcget {session.ad.last.attr.company}] equals "Company A" ) || ( [mcget {session.ad.last.attr.company}] equals "Company B" )} {
        return "value of the role"
    } else {
        return "other value of the role"
    }
    

    or of you want to assign a different role for every company:

    session.custom.company.role = 
    if { ( [mcget {session.ad.last.attr.company}] equals "Company A" )} {
        return roleA
    } elseif { ( [mcget {session.ad.last.attr.company}] equals "Company B" )} {
        return roleB
    } else {
        return "other value of the role"
    }