To use this function add it to the class library file named OrchestratorPluginADService.ts
GitHub Repository: https://github.com/SimonSparksUK/Orchestrator
Filename: OrchestratorPluginADService.ts
Private Function: ADUserGroupGetAttribute
private ADUserGroupGetAttribute<T>(objADUserGroup: AD_UserGroup, strADUserGroupAttributeName: string): T {
this.objLogger.info(`Getting AD User Group Attribute '${strADUserGroupAttributeName}'.`);
let anyADUserGroupAttribute: T = objADUserGroup.getAttribute(strADUserGroupAttributeName) as T;
return anyADUserGroupAttribute;
}Private Function: ADUserGroupSetAttribute
private ADUserGroupSetAttribute<T>(objADUserGroup: AD_UserGroup, strADUserGroupAttributeName: string, anyADUserGroupAttributeValue: T): boolean {
this.objLogger.info(`Setting AD User Group Attribute '${strADUserGroupAttributeName}' with value '${anyADUserGroupAttributeValue.toString()}'.`);
try {
objADUserGroup.setAttribute(strADUserGroupAttributeName, anyADUserGroupAttributeValue as any);
return true;
}
catch (objException) {
//@ts-ignore
this.objLogger.error(`Failed to set attribute '${strADUserGroupAttributeName}=${anyADUserGroupAttributeValue.toString()}' for User Group ${objADUserGroup.name}\n\t${objException}`);
return false;
}
}Private Function: ADUserGroupAddAttribute
private ADUserGroupAddAttribute<T>(objADUserGroup: AD_UserGroup, strADUserGroupAttributeName: string, anyADUserGroupAttributeValue: T): boolean {
this.objLogger.info(`Adding AD User Group Attribute '${strADUserGroupAttributeName}' with value '${anyADUserGroupAttributeValue.toString()}'.`);
try {
//@ts-ignore
objADUserGroup.addAttribute(strADUserGroupAttributeName, anyADUserGroupAttributeValue);
return true;
}
catch (objException) {
//@ts-ignore
this.objLogger.error(`Failed to add attribute '${strADUserGroupAttributeName}=${anyADUserGroupAttributeValue.toString()}' for User Group ${objADUserGroup.name}\n\t${objException}`);
return false;
}
}Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
