Skip to main content

ERUCES::TEAdmin

#include <teadmin.h>

The TEAdmin class represents a Key Service administrator.

The TEAdmin class provides management of Native users.

Inheritance

Public Types

enum PRINCIPAL_LIST_TYPE

The PRINCIPAL_LIST_TYPE enumeration indicates principal type.

ValueDescription
PRINCIPAL_ALLcan be used to retrieve all types of principals except TEUserPasswordInfo_V1, which can only be retrieved using PRINCIPAL_USERANDPASSWORD_V1; Not supported by all server levels.
PRINCIPAL_USERANDPASSWORDRepresents TEUserAndPassword (ERUCES Native) principals; Not supported by all server levels.
PRINCIPAL_WINDOWSRepresents TEWindowsPrincipalInfo (Kerberos) principals; Not supported by all server levels.
PRINCIPAL_GROUPRepresents TEGroupInfo Group principals.
PRINCIPAL_LDAPRepresents TELDAPPrincipalInfo principals.
PRINCIPAL_TRANSPORTRepresents TETransportPrincipalInfo transport principals.
PRINCIPAL_UNIXRepresents TEUnixPrincipalInfo Unix/NIS principals.

Protected Attributes

TypeNameDescription
void *m_pConn
void *m_pTEConn

Public Member Functions

MemberDescription
TEAdmin()The TEAdmin constructor is the default class constructor.
~TEAdmin()The TEAdmin destructor is the class destructor.
void attachConnection(TEConnection *conn)The attachConnection method attaches a connection to the object.
void detachConnection()The detachConnection method detaches a connection from the object.
void addPrincipal(const TEPrincipalInfo &principal1, TEPrincipalInfo &principal2)The addPrincipal method adds a new principal to server.
void removePrincipal(const TEPrincipalInfo &principal, const TEPrincipalInfo &principalReplace)The removePrincipal method removes a principal from server.
void removePrincipal(const TEPrincipalInfo &principal)The removePrincipal method removes a principal from server.
void updatePrincipal(TEPrincipalInfo &principal)The updatePrincipal method updates a principal.
void getPrincipal(const TEPrincipalInfo &principal1, TEPrincipalInfo &principal2) constThe getPrincipal method retrieves a principal from the server.
void resetPassword(const _TESTD string &user, const _TESTD string &password)The resetPassword method resets the current logon user's password.
unsigned int getPrincipalList(PRINCIPAL_LIST_TYPE type, TEObjectContainer &container, uint32_t sid=0) constThe getPrincipal method gets a specific principal based on given principal type.
bool getPrincipalByName(TEPrincipalInfo &principal)The getPrincipalByName method gets a principal having a specific name.
bool getPrincipalByID(TEPrincipalInfo &principal)The getPrincipalById method gets a principal using a specific ID.
_TESTD auto_ptr< TEPrincipalInfo > getPrincipalByID(te_oid pid, uint32_t sid=0)The getPrincipalById method gets a principal using a specific principal ID and a specific system ID.
void getPrincipalByID(TEObjectContainer &contIDs, TEObjectContainer &contPals)The getPrincipalById method gets multiple principals using multiple IDs.
void getPrincipalByID(TEObjectContainer &contIDs, TEObjectContainer &contSIDs, TEObjectContainer &contPals)The getPrincipalById method gets multiple principals using multiple principal IDs and multiple system IDs.
void addRole(const TEUserRole &role1, TEUserRole &role2)The addRole method adds a role to the Key Service.
void getRole(const TEUserRole &role1, TEUserRole &role2) constThe getRole method gets a role from the Key Service.
void updateRole(TEUserRole &role)The updateRole method updates information in a role object.
void removeRole(te_oid rid)The removeRole method removes a role from the Key Service.
void getRoleList(TEObjectContainer &cont) constThe getRoleList method gets a list of all roles in the system.
void assignRoles(TEPrincipalInfo &principal, TEObjectContainer &roles)The assignRoles method assigns multiple roles to a principal.
void removeRoles(TEPrincipalInfo &principal, TEObjectContainer &roles)The removeRoles method removes multiple roles from a principal.
void getOperationList(TEObjectContainer &ops) constThe getOperationList method gets a list of all operations in the system.
bool issueCertificate(const _TESTD string &csr, _TESTD string &chain, _TESTD string &id)The issueCertificate method issues a certificate.
void renewCertificate(const _TESTD string &cert, _TESTD string &chain, _TESTD string &id)The renewCertificate method renews a certificate.
void resetTransportPrincipal(const _TESTD string &subject)The resetTransportPrincipal method renews a transport principal certificate.
void acceptCertificate(const _TESTD string &chain)The acceptCertificate method adds a transport principal certificate to the system.
uint32_t getSystemID()The getSystemID method gets a system identifier for the currently connected Key Service.
void getVersion(uint32_t *major, uint32_t *minor, uint32_t *build, uint32_t *edition, _TESTD string &ver)The getVersion method gets version information for the currently connected Key Service.
void getACL(const _TESTD string &hl, TEACLInfo &acl, bool decode=false) constThe getACL method gets ACL information for a specific TTag.
void updateACL(short code, TEACLInfo &acl)The updateACL method modifies ACL information.
void assignGroups(TEPrincipalInfo &principal, TEObjectContainer &groups)The assignGroups method assigns multiple groups to a principal. The given principal will become a member of all given groups.
void removeGroups(TEPrincipalInfo &principal, TEObjectContainer &groups)The removeGroups method removes a principal from multiple groups.
void addPrincipalsToGroup(te_oid gid, TEObjectContainer &pids)The addPrincipalsToGroup method adds multiple principals to a group.
void removePrincipalsFromGroup(te_oid gid, TEObjectContainer &pids)The removePrincipalsFromGroup method removes multiple principals from a group.

Protected Member Functions

MemberDescription
const void * getConnection() constThe getConnection method gets an attached connection object.

Member Function Documentation

TEAdmin()

The TEAdmin constructor is the default class constructor.

~TEAdmin()

The TEAdmin destructor is the class destructor.

void attachConnection(TEConnection *conn)

The attachConnection method attaches a connection to the object.

Parameters

ParameterDescription
connpointer of connection object

void detachConnection()

The detachConnection method detaches a connection from the object.

void addPrincipal(const TEPrincipalInfo &principal1, TEPrincipalInfo &principal2)

The addPrincipal method adds a new principal to server.

Parameters

ParameterDescription
principal1principal object to be added
principal2principal object returned after it's been added.

void removePrincipal(const TEPrincipalInfo &principal, const TEPrincipalInfo &principalReplace)

The removePrincipal method removes a principal from server.

Build-in principal cannot be removed.

Parameters

ParameterDescription
principalprincipal object to be removed
principalReplaceprincipal object which will take over ownership of all TTag of removal principal

void removePrincipal(const TEPrincipalInfo &principal)

The removePrincipal method removes a principal from server.

Build-in role cannot be removed.

DeprecatedThis method is only workable for Database Edition.

Parameters

ParameterDescription
principalprincipal to be removed

void updatePrincipal(TEPrincipalInfo &principal)

The updatePrincipal method updates a principal.

Parameters

ParameterDescription
principalprincipal object to be updated

void getPrincipal(const TEPrincipalInfo &principal1, TEPrincipalInfo &principal2) const

The getPrincipal method retrieves a principal from the server.

Parameters

ParameterDescription
principal1input principal object with search criteria
principal2output principal object

void resetPassword(const _TESTD string &user, const _TESTD string &password)

The resetPassword method resets the current logon user's password.

Parameters

ParameterDescription
userstring of user name
passwordstring of user's new password

Remark: This method can be used for both Database Edition and File Protection Edition

unsigned int getPrincipalList(PRINCIPAL_LIST_TYPE type, TEObjectContainer &container, uint32_t sid=0) const

The getPrincipal method gets a specific principal based on given principal type.

Parameters

ParameterDescription
typetype of principals to be returned. See PRINCIPAL_LIST_TYPE.
containercontainer of principals returned
sidServer's system ID. If sid=0, retrieve principals from local Key Service. If sid>0, try to retrieve principals from remote Key Servicewhich has the given system ID.

Returns: number of principals returned

bool getPrincipalByName(TEPrincipalInfo &principal)

The getPrincipalByName method gets a principal having a specific name.

Parameters

ParameterDescription
principalin/out principal object. It is used to pass principal type and name for fetching and to output detailed principal data.

Returns: A boolean representing true-find a principal with given type and name. false-cannot find any principal with given type and name.

bool getPrincipalByID(TEPrincipalInfo &principal)

The getPrincipalById method gets a principal using a specific ID.

Parameters

ParameterDescription
principalprincipal object which keeps principal ID for fetching and detailed output principal data

Returns: A boolean representing true-find a principal with given principal ID false-cannot find any principal with given principal ID

_TESTD auto_ptr< TEPrincipalInfo > getPrincipalByID(te_oid pid, uint32_t sid=0)

The getPrincipalById method gets a principal using a specific principal ID and a specific system ID.

Parameters

ParameterDescription
pidprincipal ID used to fetch principal object
sidsystem ID. If sid=0, retrieve principal from local Key Server. If sid>0, try to retrieve principal from remote Key Server which has the same system ID.

Returns: principal object with given principal ID and system ID

void getPrincipalByID(TEObjectContainer &contIDs, TEObjectContainer &contPals)

The getPrincipalById method gets multiple principals using multiple IDs.

Parameters

ParameterDescription
contIDscontainer of principal IDs. Type objects in the container must be TEOID.
contPalscontainer of principal objects returned. Type objects in the container will be TEPrincipalInfo.

void getPrincipalByID(TEObjectContainer &contIDs, TEObjectContainer &contSIDs, TEObjectContainer &contPals)

The getPrincipalById method gets multiple principals using multiple principal IDs and multiple system IDs.

Parameters

ParameterDescription
contIDscontainer of principal IDs. Type objects in the container must be TEOID.
contSIDscontainer of systems IDs. Type objects in the container must be TEUInt32. If a system ID is 0, then corresponding principal will be retrieved from local Key Server. If the container is empty, all principals will be retrieved from local Key Server.
contPalscontainer of principal objects returned. Type objects in the container will be TEPrincipalInfo.

void addRole(const TEUserRole &role1, TEUserRole &role2)

The addRole method adds a role to the Key Service.

Parameters

ParameterDescription
role1Role object to be added
role2Role object returned after it's been added.

void getRole(const TEUserRole &role1, TEUserRole &role2) const

The getRole method gets a role from the Key Service.

Parameters

ParameterDescription
role1Rrole object used to pass search criteria.
role2Role object returned.

void updateRole(TEUserRole &role)

The updateRole method updates information in a role object.

Parameters

ParameterDescription
roleRole object to be updated. Role ID must be given. Build-in role cannot be updated.

void removeRole(te_oid rid)

The removeRole method removes a role from the Key Service.

Parameters

ParameterDescription
ridThe role ID of role to be removed.

void getRoleList(TEObjectContainer &cont) const

The getRoleList method gets a list of all roles in the system.

Parameters

ParameterDescription
contA container of roles returned. Type of object in container will be TERole.

void assignRoles(TEPrincipalInfo &principal, TEObjectContainer &roles)

The assignRoles method assigns multiple roles to a principal.

Parameters

ParameterDescription
principalThe principal object to which roles assigned to.
rolesA container holding multiple roles to be assigned to the principal. Type of object in the container must be TERole.

void removeRoles(TEPrincipalInfo &principal, TEObjectContainer &roles)

The removeRoles method removes multiple roles from a principal.

Parameters

ParameterDescription
principalThe principal object from which roles remomved.
rolesA container holding multiple roles to be assigned to the principal. Type of object in the container must be TERole.

void getOperationList(TEObjectContainer &ops) const

The getOperationList method gets a list of all operations in the system.

Parameters

ParameterDescription
opsA container to hold the operations returned. Type of object in the container will be TEOperation.

bool issueCertificate(const _TESTD string &csr, _TESTD string &chain, _TESTD string &id)

The issueCertificate method issues a certificate.

Parameters

ParameterDescription
csrA string representing a certificate request.
chainA returned certificate chain.
idA returned certificate ID.

Returns: true - if certificate is issued, false - if submitted in pending request queue

void renewCertificate(const _TESTD string &cert, _TESTD string &chain, _TESTD string &id)

The renewCertificate method renews a certificate.

Parameters

ParameterDescription
certA string representing the certificate.
chainA returned certificate chain.
idA returned certificate ID.

void resetTransportPrincipal(const _TESTD string &subject)

The resetTransportPrincipal method renews a transport principal certificate.

Parameters

ParameterDescription
subjectA string representing the transport principal subject.

void acceptCertificate(const _TESTD string &chain)

The acceptCertificate method adds a transport principal certificate to the system.

Parameters

ParameterDescription
chainA returned certificate chain.

uint32_t getSystemID()

The getSystemID method gets a system identifier for the currently connected Key Service.

Returns: Returns an integer representing the system ID.

void getVersion(uint32_t *major, uint32_t *minor, uint32_t *build, uint32_t *edition, _TESTD string &ver)

The getVersion method gets version information for the currently connected Key Service.

Parameters

ParameterDescription
majorA pointer to an integer representing a major portion of the version information.
minorA pointer to an integer representing a minor portion of the version information.
buildA pointer to an integer representing build information.
editionA pointer to an integer representing Key Service edition information.
verA string representing all version information.

void getACL(const _TESTD string &hl, TEACLInfo &acl, bool decode=false) const

The getACL method gets ACL information for a specific TTag.

Parameters

ParameterDescription
hlA string representing a TTag.
aclA returned ACLInfo object.
decodeA boolean value flag indicating whether the TTag is Base64 encoded; TRUE = TTag is Base64 encoded and must be decoded, FALSE = TTag is not Base64 encoded.

void updateACL(short code, TEACLInfo &acl)

The updateACL method modifies ACL information.

Parameters

ParameterDescription
codeThe modification mode to update ACL data.
aclThe TEACLInfo object to be updated.

void assignGroups(TEPrincipalInfo &principal, TEObjectContainer &groups)

The assignGroups method assigns multiple groups to a principal. The given principal will become a member of all given groups.

Parameters

ParameterDescription
principalThe principal to which the groups will be assigned.
groupscontainer holding multiple group IDs; must be TEOID type objects.

void removeGroups(TEPrincipalInfo &principal, TEObjectContainer &groups)

The removeGroups method removes a principal from multiple groups.

Parameters

ParameterDescription
principalThe principal object to be removed from the groups.
groupsA container holding multiple IDs of the groups from which the principal will be removed.

void addPrincipalsToGroup(te_oid gid, TEObjectContainer &pids)

The addPrincipalsToGroup method adds multiple principals to a group.

Parameters

ParameterDescription
gidThe ID of the group to which the principals will be added.
pidsThe IDs of the principals to be added to the group.

void removePrincipalsFromGroup(te_oid gid, TEObjectContainer &pids)

The removePrincipalsFromGroup method removes multiple principals from a group.

Parameters

ParameterDescription
gidThe ID of the group from which the principals will be removed.
pidsA container holding multiple IDs of the principals to be removed from the group.

const void * getConnection() const

The getConnection method gets an attached connection object.

Returns: Returns a connection object pointer.