Roles Actions
  • 03 Jun 2022
  • 2 Minutes to read
  • Dark
    Light

Roles Actions

  • Dark
    Light

Article Summary

deletePortalRole

Deletes a Portal role.

Property

Value

Description

connection*

expression, variable

the Portal connection definition

roleDNOrID*

text, expression, variable

the DN or IdautoID of the role to delete

returnVariable

expression, variable

name of the variable to be assigned to the return value

deleted = deletePortalRole(connection,
"CN=My Role,OU=groups,DC=example,DC=com")

getPortalRoleMembership

Obtains the DN or IdAutoId of all members in the listed Role.

Property

Value

Description

connection*

expression, variable

The Identity Portal connection definition

roleDNsORId*

text, expression, variable

The DN or the IdAutoID of the user

returnVariable

expression, variable

Returns an array of Role DNs or IdAutoIDs

See action openPortalRoleMembershipIterator for code example.

importPortalRole

Initiate import of a particular new Portal role.

Property

Value

Description

connection*

expression, variable

the Portal connection definition

roleId*

text, expression, variable

the IdautoID of the role to import

syncAfterImport*

boolean, expression, variable

whether the imported role should be synced after importing

returnVariable

expression, variable

name of the variable to be assigned to the return value

groupId = getIdautoIDForGroup(connection,
"CN=My New Group,OU=groups,DC=example,DC=com")
success = importPortalRole(connection, groupId, true)

importPortalRoles

Initiate import of new Portal roles.

Property

Value

Description

connection*

expression, variable

the Portal connection definition

syncAfterImport*

boolean, expression, variable

whether imported roles should be synced after the import completes

returnVariable

expression, variable

name of the variable to be assigned to the return value

success = importPortalRoles(connection, true)

isPortalUserInAllRoles

Property

Value

Description

connection*

expression, variable

The Identity Portal connection definition

userDNorID*

text, expression, variable

The DN or the IdAutoID of the user

roleDNsORIds*

expression, variable

An array of Role DNs or IdAutoIDs

returnVariable

expression, variable

Returns true or false.

isPortalUserInAnyRoles

Determines whether a listed user is a member of any of queried roles.

Property

Value

Description

connection*

expression, variable

The Identity Portal connection definition

userDNorID*

text, expression, variable

The DN or the IdAutoID of the user

roleDNsORIds*

expression, variable

An array of Role DNs or IdAutoIDs

returnVariable

expression, variable

Returns true or false.

conn = definePortalConnection("https://localhost:8443", "username",
<Password>, true)
array = createArray(6)
insertArrayItem(array, 0, "CN=Role Managers,OU=managed,OU=groups,
DC=test,DC=local")
insertArrayItem(array, 1, "0b0ad0e1-2222-3333-ceds-44se4444")
insertArrayItem(array, 2, "0ed8092a-29dw-23ub-sw19-23sdf09u")
insertArrayItem(array, 3, "sedrofle-234n-32fs-2wld-sadf343d")
insertArrayItem(array, 4, "34ajedf2-a232-adv0-a34w-adf3ljww")
result = isPortalUserInAllRoles(conn,
"34dsaer2-2342-saef-adv9-e4sdv039", array)
log(result)
log(" ")
result = isPortalUserInAnyRoles(conn,
"34dsaer2-2342-saef-adv9-e4sdv039", array)
log(result)
close(conn)

openPortalRoleMembershipIterator

Opens an iterator over the members of a particular Portal Role.

Property

Value

Description

connection*

expression, variable

The Identity Portal connection definition

roleDNsORId*

text, expression, variable

The DN or the IdAutoID of the user

returnVariable

expression, variable

Returns an array of Role DNs or IdAutoIDs

conn = definePortalConnection("https://localhost:8443", "username",
<Password>, true)
result = getPortalRoleMembership(conn,
"CN=Role Managers,OU=managed,OU=groups,DC=test,DC=local")
log(result)
#
# With membership array in hand, add two new members to the role
in the Roles module of Identity Portal
#
# Use the iterator to obtain the two new role members
#
records = openPortalRoleMembershipIterator(conn,
"CN=Role Managers,OU=managed,OU=groups,DC=test,DC=local")
forEach(record, records) {
log(record)
}
close(conn)

syncPortalRole

Initiate synchronization of a Portal role.

Property

Value

Description

connection*

expression, variable

the Portal connection definition

roleDN*

text, expression, variable

the DN of the role

returnVariable

expression, variable

name of the variable to be assigned to the return value

success = syncPortalRole(connection, "CN=testgroup1,OU=groups,
DC=test,DC=idauto,DC=lab")

syncPortalMembership

Sync membership among all Portal roles for a single user.

Property

Value

Description

connection*

expression, variable

the Portal connection definition

userDNOrID*

text, expression, variable

the DN or IdautoID of the user to sync

returnVariable

expression, variable

name of the variable to be assigned to the return value

syncResult = syncPortalMembership(connection, "CN=Test User,
OU=people,DC=example,DC=com")
if(hasRecordField(syncResult, "added") {
forEach(addedDN, getRecordFieldValues(syncResult, "added")) {
log( "The user was added to role " + addedDN )
}
} else {
log( "The user was added to no role" )
}
if (hasRecordField(syncResult, "removed")) {
forEach(removedDN, getRecordFieldValues(syncResult, "removed")) {
log("The user was removed from role " + removedDN)
}
} else {
log("The user was removed from no roles")
}

Was this article helpful?