UserLock API
Topics
Protected accounts

Topics

 
 Time quota
 
 Time restrictions
 
 Workstation restrictions
 

Detailed Description

Example: Create a protected account, get its configuration from the server, modify its configuration and upload its new configuration

string userAccount = "DOMAIN\\UserName";
if (!userLockServer.DoesProtectedAccountExist(userAccount))
{ // If the protected account doesn't exist create it
if (!userLockServer.AddProtectedUser(userAccount))
throw new Exception(userLockServer.Connection.LastMessage); // Failed to create the protected account throw an exception
}
ProtectedAccount protectedAccount = userLockServer.GetProtectedAccount(userAccount); // Retrieve an instance of the protected account with all properties
protectedAccount.ExceptTimeFramesNew = 0; // Logon will be allowed in the listed time frames
TimeFrame timeFrame = new TimeFrame();
timeFrame.DaysOfWeek = TimeFrame.WeekDays.Monday | TimeFrame.WeekDays.Tuesday; // Allowed to logon on Monday and Tuesday
timeFrame.MinutesFrom = 8 * 60; // From 7 AM
timeFrame.MinutesTo = 18 * 60; // To 6 PM
protectedAccount.TimeFrames.Clear(); // Start from an empty time frame list
protectedAccount.TimeFrames.Add(timeFrame); // Add the time frame to the list
protectedAccount.ExpirationActionNew = ProtectedAccount.ExpirationActionEnum.Logoff; // Close the session when outside allowed hours
protectedAccount.TimeCountdown = 5; // Session will be closed after a notification of 5 minutes
TimeQuota timeQuota = new TimeQuota();
timeQuota.SessionTypes = SessionType.Interactive; // time quota for interactive sessions
timeQuota.Periodicity = TimeQuota.Period.Day; // to apply in each day
timeQuota.TimeLength = new TimeSpan(3, 0, 0); // 3 hours in a day
protectedAccount.TimeQuotas.Clear(); // Start from an empty quota list
protectedAccount.TimeQuotas.Add(timeQuota); // add the quota to the list
protectedAccount.EnabledTimeQuotas = true; // time quotas are enabled
protectedAccount.SetInfo(); // update the protected account on the server
SessionType
Different types of sessions. A session has only one type but several types can be specified in severa...
Definition Session.cs:11