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: ADUserAttributeGet
private ADUserAttributeGet<T>(objADUser: AD_User, strADUserAttributeName: string): T {
this.objLogger.info(`Getting AD User Attribute '${strADUserAttributeName}'.`);
let anyADUserAttribute: T = objADUser.getAttribute(strADUserAttributeName) as T;
return anyADUserAttribute;
}Private Function: ADUserAttributeSet
private ADUserAttributeSet<T>(objADUser: AD_User, strADUserAttributeName: string, anyADUserAttributeValue: T): boolean {
this.objLogger.info(`Setting AD User Attribute '${strADUserAttributeName}' with value '${anyADUserAttributeValue.toString()}'.`);
try {
//@ts-ignore
objADUser.setAttribute(strADUserAttributeName, anyADUserAttributeValue);
return true;
}
catch {
return false;
}
}Private Function: ADUserAttributeAdd
private ADUserAttributeAdd<T>(objADUser: AD_User, strADUserAttributeName: string, anyADUserAttributeValue: T): boolean {
this.objLogger.info(`Adding AD User Attribute '${strADUserAttributeName}' with value '${anyADUserAttributeValue.toString()}'.`);
try {
//@ts-ignore
objADUser.addAttribute(strADUserAttributeName, anyADUserAttributeValue);
return true;
}
catch {
return false;
}
}
Discover more from Cloud Build Tools
Subscribe to get the latest posts sent to your email.
