Difference between revisions of "SwivelAdminRequest Documentation"
m (1 revision imported) |
|
(No difference)
|
Latest revision as of 12:52, 11 May 2017
Contents
Overview
Class name: SwivelAdminRequest
Namespace: swivelsecure.client
This class is a wrapper round the XML-based Admin API. It allows full create, read, update and delete (CRUD) functionality over a limited set of users within a Swivel database. The ser of users is limited in that they must all belong to a single Repository, named after the Agent corresponding to the computer the application is running on.
NOTE: it is possible to set the Agent name to be the same as that of an existing Repository (e.g. an Active Directory Repository). This gives the Agent control over an existing set of users. However, this behaviour is discouraged, since most changes will be overwritten the next time the Repository is synchronised with its source. It is, however, the only way to manage the case where you need to read details for an existing user, since the helpdesk API does not currently support reading users.
A typical example of usage for this class is as follows:
- Create an instance of the class:
SwivelAdminRequest req = new SwivelAdminRequest();
- Create one or more users linked to the request class:
SwivelUser user = new SwivelUser(req, txtUsername.Text);
- Modify the user instance in some way:
user.SetAlertTransport("SMTP", txtEmail.Text); user.Groups = new List<string> { "PINsafeUsers" }; user.Grant(SwivelUserRight.single, SwivelUserRight.dual, SwivelUserRight.swivlet);
- Call one of the operational methods on the user or users:
req.CreateUser(user);
- Call the Send method to execute the command:
req.Send();
Constructors
SwivelAdminRequest()
Constructor for request using default settings.
SwivelAdminRequest(SwivelSettings settings)
Constructor for request using specified settings. settings: The settings to use
Methods
void CreateUser(SwivelUser user)
Add a command to create the specified user to the request. user: The user to add
void CreateUsers(List<SwivelUser> users)
Add a command to create the specified list of users to the request. users: The list of users to add
void DeleteUser(SwivelUser user)
Add a command to delete the specified user to the request. user: The user to delete
void DeleteUsers(List<SwivelUser> users)
Add a command to delete the specified list of users to the request. users: The list of users to delete
void UpdateUser(SwivelUser user)
Add a user update command to the request. user: The user to update
Note: Users are not notified of updates to PIN etc, unless specifically requested.
void UpdateUsers(List<SwivelUser> users)
Add an update command for multiple users to the request. users: The list of users to update
Note: Users are not notified of updates to PIN etc, unless specifically requested.
void ReadUser(SwivelUser user)
Add a command to read details for a specified user. user: The user to read
void ReadUsers(List<SwivelUser> users)
Add a command to read details for a specified list of users. users: The list of users to read
void ResetUser(SwivelUser user)
Add a PIN reset request for the specified user. user: The user to reset
void ResetUsers(List<SwivelUser> users)
Add a PIN reset request for the specified list of users. users: The list of users to reset
void Report(SwivelReport report)
Add a report element to the request. report: The report to add. Note that the report cannot specify a repository name in this case.
bool Send()
Send the completed request to the Swivel server. This method must be called after all changes are made to the request in order to execute the request. Returns True if a valid response was received from PINsafe. Does not necessarily mean that the request succeeded.
XmlElement RequestElement()
Get the top-level XmlElement from the request
XmlElement CreateElement(string name)
Create a new XmlElement with the required name. Provided for future enhancement. You should not need to call this method directly.
string ToString()
Override of the base ToString() method. Returns The XML representation of the request
Properties
SwivelAdminAPIResponse Response
The encapsulated response returned by PINsafe.
TimeSpan ResponseTime
The time it took to execute the last request.