AcUtils
A high performance abstraction layer for AccuRev
Public Member Functions | Private Member Functions | List of all members
AcUtils.AcUsers Class Reference

A container of AcUser objects that define AccuRev users. More...

Collaboration diagram for AcUtils.AcUsers:
Collaboration graph
[legend]

Public Member Functions

AcUser getUser (string name)
 Get the AcUser object for AccuRev principal name. More...
 
AcUser getUser (int ID)
 Get the AcUser object for AccuRev principal ID number. More...
 
AcUser getWorkspaceOwner (string name)
 Get the AcUser object owner of AccuRev workspace name. More...
 
Two-part object construction:
 AcUsers (DomainCollection dc=null, PropCollection pc=null, bool includeGroupsList=false, bool includeDeactivated=false)
 A container of AcUser objects that define AccuRev users. Elements contain user principal attributes name, ID, and status (active or inactive). Optionally, the user's AccuRev group membership list, regular and other user properties from Active Directory, and deactivated (removed) users can be included as well. More...
 
async Task< bool > initAsync (IProgress< int > progress=null)
 Populate this container with AcUser objects as per constructor parameters. More...
 

Private Member Functions

async Task< bool > initUserPropsAsync (AcUser user)
 Helper function for initializing user with their Active Directory properties and group memberships as per constructor parameters. Called internally and not by user code. More...
 

Detailed Description

A container of AcUser objects that define AccuRev users.

Elements contain user principal attributes name, ID, and status (active or inactive). In addition, the user's AccuRev group membership list, regular and other user properties from Active Directory, and deactivated (removed) users can be included as well.

Attention
User properties require that AccuRev principal names match login names stored on the LDAP server.

Definition at line 497 of file AcUsers.cs.

Constructor & Destructor Documentation

AcUtils.AcUsers.AcUsers ( DomainCollection  dc = null,
PropCollection  pc = null,
bool  includeGroupsList = false,
bool  includeDeactivated = false 
)
inline

A container of AcUser objects that define AccuRev users. Elements contain user principal attributes name, ID, and status (active or inactive). Optionally, the user's AccuRev group membership list, regular and other user properties from Active Directory, and deactivated (removed) users can be included as well.

Including group membership initialization (includeGroupsList = true) is slower, so we give the option to exclude it when the list isn't needed. A user's group membership list includes groups from implicit membership, i.e. if user is a member of groupA and groupA is a member of groupB, the user is implicitly a member of groupB.

Parameters
dcList of DomainElement objects as defined in <prog_name>.exe.config domains section. Used to initialize the user properties default set from Active Directory.
pcList of PropElement objects as defined in <prog_name>.exe.config properties section. Used to add and initialize user properties from Active Directory that are outside the regular default set. Note: requires a valid DomainCollection dc parameter.
includeGroupsListtrue to include group membership initialization for each user (slower), false for no initialization (faster).
includeDeactivatedtrue to include deactivated (removed) users, otherwise false.
ADSection adSection = ConfigurationManager.GetSection("activeDir") as ADSection;
_domains = adSection.Domains;
_pc = adSection.Props;
...
toolStripStatusLabel.Text = "Loading users...";
toolStripProgressBar.Maximum = await AcQuery.getUsersCountAsync();
var progress = new Progress<int>(i => toolStripProgressBar.Value = i);
AcUsers users = new AcUsers(_domains, _pc, includeGroupsList: true);
if (await users.initAsync(progress)) // if successful
{
foreach (AcUser user in users.OrderBy(n => n)) // use default comparer
...
Attention
User properties require that AccuRev principal names match login names stored on the LDAP server.
See also
initAsync, AcUser.initGroupsListAsync, AcUser.initFromADAsync, default comparer, AcGroups constructor

Definition at line 548 of file AcUsers.cs.

Member Function Documentation

AcUser AcUtils.AcUsers.getUser ( string  name)
inline

Get the AcUser object for AccuRev principal name.

Parameters
nameAccuRev principal name.
Returns
AcUser object for principal name or null if not found.

Definition at line 660 of file AcUsers.cs.

Referenced by AcUtils.AcUsers.getWorkspaceOwner().

AcUser AcUtils.AcUsers.getUser ( int  ID)
inline

Get the AcUser object for AccuRev principal ID number.

Parameters
IDAccuRev principal ID number.
Returns
AcUser object for principal ID number or null if not found.

Definition at line 670 of file AcUsers.cs.

AcUser AcUtils.AcUsers.getWorkspaceOwner ( string  name)
inline

Get the AcUser object owner of AccuRev workspace name.

Parameters
nameName of the workspace to query.
Returns
AcUser object for owner of workspace name or null if not found.

Definition at line 680 of file AcUsers.cs.

async Task<bool> AcUtils.AcUsers.initAsync ( IProgress< int >  progress = null)
inline

Populate this container with AcUser objects as per constructor parameters.

Parameters
progressOptionally report progress back to the caller.
Returns
true if list initialization succeeded, false otherwise.
Exceptions
AcUtilsExceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on show command failure.
Exceptioncaught and logged in same on failure to handle a range of exceptions.
show command:
show <-fx | -fix> users

Definition at line 565 of file AcUsers.cs.

async Task<bool> AcUtils.AcUsers.initUserPropsAsync ( AcUser  user)
inlineprivate

Helper function for initializing user with their Active Directory properties and group memberships as per constructor parameters. Called internally and not by user code.

Parameters
userThe user to initialize.
Returns
true if list initialization succeeded, false otherwise.
Exceptions
Exceptioncaught and logged in %LOCALAPPDATA%\AcTools\Logs\<prog_name>-YYYY-MM-DD.log on failure to handle a range of exceptions.

Definition at line 624 of file AcUsers.cs.

Referenced by AcUtils.AcUsers.initAsync().