C++/CLI Sample
Demonstrates how to create a C++/CLI library using the VideoXpert SDK
CPPCli::User Class Reference

The User class represents information about a system user. More...

#include <User.h>

Public Types

enum  PhoneType {
  PhoneType::Home,
  PhoneType::HomeFax,
  PhoneType::Mobile,
  PhoneType::Other,
  PhoneType::Pager,
  PhoneType::Work,
  PhoneType::WorkFax
}
 Values that represent the type of a phone number. More...
 

Public Member Functions

 User (VxSdk::IVxUser *vxUser)
 Constructor. More...
 
virtual ~User ()
 Destructor. More...
 
 !User ()
 Finaliser. More...
 
CPPCli::Results::Value AddToRole (CPPCli::Role^ role)
 Add this user to a role. More...
 
Results::Value Refresh ()
 Update this instances properties. More...
 
CPPCli::Results::Value RemoveFromRole (CPPCli::Role^ role)
 Remove this user from a role. More...
 
CPPCli::Results::Value SetPassword (System::String^ newPassword)
 Submit a request for a password change. More...
 

Package Functions

bool _GetAccountState ()
 
System::Collections::Generic::List< DataObject^ >^ _GetDataObjects ()
 
System::Collections::Generic::List< Role^ >^ _GetRoles ()
 
System::Collections::Generic::List< Tag^ >^ _GetTags ()
 

Package Attributes

VxSdk::IVxUser_user
 

Properties

bool AccountState [get, set]
 Gets or sets the state of the user account, either enabled or disabled. More...
 
System::Collections::Generic::List< DataObject^ >^ DataObjects [get]
 Gets all private data objects owned by this user and all public data objects. Other user’s private data objects will not be returned. More...
 
System::String^  Domain [get, set]
 Gets or sets the network domain for this user. More...
 
System::String^  EmployeeId [get, set]
 Gets or sets the employee identifier associated with the user. More...
 
System::String^  FirstName [get, set]
 Gets or sets the first name of user. More...
 
System::String^  Id [get]
 Gets the unique identifier of the user. More...
 
System::String^  LastName [get, set]
 Gets or sets the last name of user. More...
 
System::String^  Name [get, set]
 Gets or sets the friendly name, within the domain, of the user. More...
 
System::String^  Note [get, set]
 Gets or sets supplemental information about the user. More...
 
System::DateTime PasswordExpiration [get]
 Gets the time at which the user’s password will expire. More...
 
System::Collections::Generic::List< System::Collections::Generic::KeyValuePair< User::PhoneType, System::String^ >>^ PhoneNumbers [get, set]
 Gets or sets the telephone number(s) for the user. More...
 
System::Collections::Generic::List< Role^ >^ Roles [get]
 Gets the roles currently assigned to this user. More...
 
System::Collections::Generic::List< Tag^ >^ Tags [get]
 Gets the tags currently assigned to this user. More...
 

Detailed Description

The User class represents information about a system user.

Definition at line 16 of file User.h.

Member Enumeration Documentation

Values that represent the type of a phone number.

Enumerator
Home 

Home number.

HomeFax 

Home fax number.

Mobile 

Mobile number.

Other 

Other number.

Pager 

Pager number.

Work 

Work number.

WorkFax 

Work fax number.

Definition at line 22 of file User.h.

22  {
24  Home,
25 
27  HomeFax,
28 
30  Mobile,
31 
33  Other,
34 
36  Pager,
37 
39  Work,
40 
42  WorkFax
43  };

Constructor & Destructor Documentation

CPPCli::User::User ( VxSdk::IVxUser vxUser)

Constructor.

Parameters
vxUserThe vx user.

Definition at line 9 of file User.cpp.

9  {
10  _user = vxUser;
11 }
VxSdk::IVxUser * _user
Definition: User.h:264
virtual CPPCli::User::~User ( )
inlinevirtual

Destructor.

Definition at line 54 of file User.h.

54  {
55  this->!User();
56  }
User(VxSdk::IVxUser *vxUser)
Constructor.
Definition: User.cpp:9
CPPCli::User::!User ( )

Finaliser.

Definition at line 13 of file User.cpp.

13  {
14  _user->Delete();
15  _user = nullptr;
16 }
virtual VxResult::Value Delete() const =0
VxSdk::IVxUser * _user
Definition: User.h:264

Member Function Documentation

bool CPPCli::User::_GetAccountState ( )
package

Definition at line 46 of file User.cpp.

46  {
47  // Get and return the account state
48  bool state;
49  _user->GetAccountState(state);
50  return state;
51 }
virtual VxResult::Value GetAccountState(bool &isEnabled) const =0
VxSdk::IVxUser * _user
Definition: User.h:264
System::Collections::Generic::List< CPPCli::DataObject^ > CPPCli::User::_GetDataObjects ( )
package

Definition at line 53 of file User.cpp.

53  {
54  // Create a list of managed data objects
55  List<DataObject^>^ mlist = gcnew List<DataObject^>();
56  // Create a collection of unmanaged data objects
58 
59  // Make the GetDataObjects call, which will return with the total data object count, this allows the
60  // client to allocate memory.
61  VxSdk::VxResult::Value result = _user->GetDataObjects(dataObjects);
62  // As long as there are data objects linked the result should be VxSdk::VxResult::kInsufficientSize
63  if (result == VxSdk::VxResult::kInsufficientSize) {
64  // Allocate enough space for the IVxDataObject collection
65  dataObjects.collection = new VxSdk::IVxDataObject*[dataObjects.collectionSize];
66  result = _user->GetDataObjects(dataObjects);
67  // The result should now be kOK since we have allocated enough space
68  if (result == VxSdk::VxResult::kOK) {
69  for (int i = 0; i < dataObjects.collectionSize; i++)
70  mlist->Add(gcnew DataObject(dataObjects.collection[i]));
71  }
72  // Remove the memory we previously allocated to the collection
73  delete[] dataObjects.collection;
74  }
75  return mlist;
76 }
virtual VxResult::Value GetDataObjects(VxCollection< IVxDataObject ** > &dataObjectCollection) const =0
VxSdk::IVxUser * _user
Definition: User.h:264
System::Collections::Generic::List< CPPCli::Role^ > CPPCli::User::_GetRoles ( )
package

Definition at line 78 of file User.cpp.

78  {
79  // Create a list of managed roles
80  List<Role^>^ mlist = gcnew List<Role^>();
81  // Create a collection of unmanaged roles
83 
84  // Make the GetRoles call, which will return with the total role count, this
85  // allows the client to allocate memory.
86  VxSdk::VxResult::Value result = _user->GetRoles(roles);
87  // As long as there are roles linked the result should be VxSdk::VxResult::kInsufficientSize
88  if (result == VxSdk::VxResult::kInsufficientSize) {
89  // Allocate enough space for the IVxRole collection
90  roles.collection = new VxSdk::IVxRole*[roles.collectionSize];
91  result = _user->GetRoles(roles);
92  // The result should now be kOK since we have allocated enough space
93  if (result == VxSdk::VxResult::kOK) {
94  for (int i = 0; i < roles.collectionSize; i++)
95  mlist->Add(gcnew Role(roles.collection[i]));
96  }
97  // Remove the memory we previously allocated to the collection
98  delete[] roles.collection;
99  }
100  return mlist;
101 }
virtual VxResult::Value GetRoles(VxCollection< IVxRole ** > &roleCollection) const =0
VxSdk::IVxUser * _user
Definition: User.h:264
System::Collections::Generic::List< CPPCli::Tag^ > CPPCli::User::_GetTags ( )
package

Definition at line 103 of file User.cpp.

103  {
104  // Create a list of managed tags
105  List<Tag^>^ mlist = gcnew List<Tag^>();
106  // Create a collection of unmanaged tags
108 
109  // Make the GetTags call, which will return with the total tag count, this
110  // allows the client to allocate memory.
111  VxSdk::VxResult::Value result = _user->GetTags(tags);
112  // As long as there are tags linked the result should be VxSdk::VxResult::kInsufficientSize
113  if (result == VxSdk::VxResult::kInsufficientSize) {
114  // Allocate enough space for the IVxTag collection
115  tags.collection = new VxSdk::IVxTag*[tags.collectionSize];
116  result = _user->GetTags(tags);
117  // The result should now be kOK since we have allocated enough space
118  if (result == VxSdk::VxResult::kOK) {
119  for (int i = 0; i < tags.collectionSize; i++)
120  mlist->Add(gcnew Tag(tags.collection[i]));
121  }
122  // Remove the memory we previously allocated to the collection
123  delete[] tags.collection;
124  }
125  return mlist;
126 }
virtual VxResult::Value GetTags(VxCollection< IVxTag ** > &tagCollection) const =0
VxSdk::IVxUser * _user
Definition: User.h:264
CPPCli::Results::Value CPPCli::User::AddToRole ( CPPCli::Role role)

Add this user to a role.

Parameters
roleThe role to add this user to.
Returns
The Result of adding the user.

Definition at line 18 of file User.cpp.

18  {
19  // Make the call to add the user to the role
20  VxSdk::VxResult::Value result = _user->AddToRole(*role->_role);
21  // Unless there was an issue adding the user the result should be VxSdk::VxResult::kOK
22  return CPPCli::Results::Value(result);
23 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value AddToRole(IVxRole &role) const =0
VxSdk::IVxUser * _user
Definition: User.h:264
CPPCli::Results::Value CPPCli::User::Refresh ( )

Update this instances properties.

Returns
The Result of updating the properties.

Definition at line 25 of file User.cpp.

25  {
27 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
VxSdk::IVxUser * _user
Definition: User.h:264
virtual VxResult::Value Refresh()=0
CPPCli::Results::Value CPPCli::User::RemoveFromRole ( CPPCli::Role role)

Remove this user from a role.

Parameters
roleThe role to remove this user from.
Returns
The Result of removing the user.

Definition at line 29 of file User.cpp.

29  {
30  // Make the call to remove the user from the role
31  VxSdk::VxResult::Value result = _user->RemoveFromRole(*role->_role);
32  // Unless there was an issue removing the user from the role the result should be VxSdk::VxResult::kOK
33  return CPPCli::Results::Value(result);
34 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
virtual VxResult::Value RemoveFromRole(IVxRole &role) const =0
VxSdk::IVxUser * _user
Definition: User.h:264
CPPCli::Results::Value CPPCli::User::SetPassword ( System::String^  newPassword)

Submit a request for a password change.

Parameters
newPasswordThe new password.
Returns
The Result of setting the password.

Definition at line 36 of file User.cpp.

36  {
37  char password[64];
39 
40  // Make the call to set the users password
41  VxSdk::VxResult::Value result = _user->SetPassword(password);
42  // Unless there was an issue setting the password the result should be VxSdk::VxResult::kOK
43  return CPPCli::Results::Value(result);
44 }
Value
Values that represent the result of calls to the VideoXpert system.
Definition: Utils.h:21
static void StrCopySafe(char(&dst)[dstSize], const char *src)
virtual VxResult::Value SetPassword(char newPassword[64]) const =0
static char * ConvertSysStringNonConst(System::String^ sysString)
Convert a system string to a char.
Definition: Utils.h:243
VxSdk::IVxUser * _user
Definition: User.h:264

Member Data Documentation

VxSdk::IVxUser* CPPCli::User::_user
package

Definition at line 264 of file User.h.

Property Documentation

bool CPPCli::User::AccountState
getset

Gets or sets the state of the user account, either enabled or disabled.

The state of the user account.

Definition at line 94 of file User.h.

System:: Collections:: Generic:: List< DataObject^>^ CPPCli::User::DataObjects
get

Gets all private data objects owned by this user and all public data objects. Other user’s private data objects will not be returned.

A list of data objects.

Definition at line 105 of file User.h.

System:: String^ CPPCli::User::Domain
getset

Gets or sets the network domain for this user.

The network domain.

Definition at line 114 of file User.h.

System:: String^ CPPCli::User::EmployeeId
getset

Gets or sets the employee identifier associated with the user.

The employee identifier.

Definition at line 128 of file User.h.

System:: String^ CPPCli::User::FirstName
getset

Gets or sets the first name of user.

The first name of user.

Definition at line 142 of file User.h.

System:: String^ CPPCli::User::Id
get

Gets the unique identifier of the user.

The unique identifier.

Definition at line 156 of file User.h.

System:: String^ CPPCli::User::LastName
getset

Gets or sets the last name of user.

The last name of user.

Definition at line 165 of file User.h.

System:: String^ CPPCli::User::Name
getset

Gets or sets the friendly name, within the domain, of the user.

The friendly name.

Definition at line 179 of file User.h.

System:: String^ CPPCli::User::Note
getset

Gets or sets supplemental information about the user.

Information about the user.

Definition at line 193 of file User.h.

System:: DateTime CPPCli::User::PasswordExpiration
get

Gets the time at which the user’s password will expire.

The password experation date.

Definition at line 207 of file User.h.

System:: Collections:: Generic:: List< System:: Collections:: Generic:: KeyValuePair< User:: PhoneType, System:: String^>>^ CPPCli::User::PhoneNumbers
getset

Gets or sets the telephone number(s) for the user.

The telephone number(s) for the user.

Definition at line 216 of file User.h.

System:: Collections:: Generic:: List< Role^>^ CPPCli::User::Roles
get

Gets the roles currently assigned to this user.

A list of assigned roles.

Definition at line 249 of file User.h.

System:: Collections:: Generic:: List< Tag^>^ CPPCli::User::Tags
get

Gets the tags currently assigned to this user.

A list of assigned tags.

Definition at line 258 of file User.h.


The documentation for this class was generated from the following files: