PtUser is used for user authorization. When you enable authorization for a database, users must log in to the database. PtUser is the base class for PtGroup, which holds the rights for groups, and PtIndividual, which holds individual rights.
The PtUser class is pre-registered in every POET dictionary, and classes for ondemands, sets, allsets, and queries for PtUser have also been pre-registered.
The following table lists the pre-registered classes, and shows the equivalent class declaration for each class:
PtUser | persistent class PtUser |
PtUserAllSet | AllSet generated from above declaration |
PtUserQuery | Query class generated from above declaration |
PtUserOnDemand | typedef ondemand<PtUser> PtUserOnDemand |
PtUserOnDemandCSet | typedef cset<ondemand<PtUser>> PtUserOnDemandCSet; |
PtUser does not have a public constructor. In your programs, you should not create a PtUser directly, you should create a PtIndividual or a PtGroup. Each of these classes is derived from PtUser.
Files to include | Class declaration | Base class |
poet.hxx ptuser.hxx | ptuser.hxx | PtObject |
protected constructor | PtUser (PtString& loginname, short userid, PtString& realname); |
protected destructor | virtual ~PtUser(); |
AccumulateRights | int AccumulateRights(PtLinkedList *); |
AddToGroup | int AddToGroup(PtGroup* ); |
Groups | inline PtGroupSet* Groups(); |
Id | inline short Id(); |
IsInGroup | int IsInGroup(PtGroup* ); |
LoginName | inline PtString LoginName(); |
RealName | inline PtString& RealName(); |
RemoveFromGroup | int RemoveFromGroup(PtGroup* ); |
Store | int Store(PtDepthMode mode = PtDEEP); |
UserRights | inline PtRightSet* UserRights(); |
- PtUser::PtUser(PtString& loginname, short userid, PtString& realname)
This constructor is protected, so you can not call it. PtUser is to be treated as an abstract base class. Create a PtIndividual or a PtGroup; both of these classes are derived from PtUser.
- virtual PtUser::~PtUser()
- inline PtString& PtUser::RealName()
Returns a reference to the string which contains the name of the user, which you can use to read or modify the name. This name normally contains the full name of the user. It is not used internally by POET.
- inline PtString PtUser::LoginName()
Returns a string which contains the login name for the user. This is a copy of the original string, changes made to this string will not affect the login name of the user.
- inline short PtUser::Id()
Returns the user's login ID by value.
- int PtUser::AddToGroup(PtGroup* pGroup)
PtGroup* pGroup | The group to which this user should be added |
Ensures that a group has no more than one entry for a given user. Remember to store both the user and the group after you add an user to a group!
- int PtUser::RemoveFromGroup(PtGroup* pGroup)
PtGroup* pGroup | The group to which this user should be added |
Remember to store both the user and the group after you remove an user from a group!
- int PtUser::IsInGroup(PtGroup* pGroup)
Determines whether the user is a member of this group.
PtGroup* pGroup | The group we are asking about |
0 | If the user is not a member of this group |
non-zero | If the user is a member of this group |
- inline PtGroupSet* PtUser::Groups()
This function returns a pointer to a set which contains all the groups that this user is a member of. PtGroupSet is pre-registered in POET's dictionary, and is declared like this:
Please do not change this set! Instead, use the functions AddToGroup() and RemoveFromGroup(), and POET will manage the PtGroupSet correctly.
- int PtUser::Store(PtDepthMode mode = PtDEEP)
Stores the PtUser. The overloaded Store Method performs some checks. 1)was the user authorization enabled at all? 2)does the user (name) or the id already exist 3)if the id was not specified by the user generate a new user id This functions exactly like PtObject:: Store().
- inline PtRightSet* PtUser::UserRights()
Description:
This function returns a pointer to a PtRightSet, which contains all of the rights which have been assigned to this user. You should not change this set directly; instead, use a PtClassRight or PtClassAttributeRight to assign rights to the user.
PtRightSet is pre-registered in every class dictionary. It is declared like this:
- inline int PtUser::AccumulateRights(PtLinkedList *)
Description:
This function is used internally.
Copyright (c) 1996 POET Software, Inc. All rights reserved. Reproduction in whole or in part in any form or medium without the express permission of POET Software, Inc. is prohibited.