Main Table of Contents


Table of Contents

class PtUser
PtUser: class summary
PtUser::PtUser()
PtUser::~PtUser()
PtUser::RealName()
PtUser::LoginName()
PtUser::Id()
PtUser::AddToGroup()
PtUser::RemoveFromGroup()
PtUser::IsInGroup()
PtUser::Groups()
PtUser::Store()
PtUser::UserRights()
PtUser::AccumulateRights()

class PtUser


Intro
PtUser: class summary
PtUser::PtUser()
PtUser::~PtUser()
PtUser::RealName()
PtUser::LoginName()
PtUser::Id()
PtUser::AddToGroup()
PtUser::RemoveFromGroup()
PtUser::IsInGroup()
PtUser::Groups()
PtUser::Store()
PtUser::UserRights()
PtUser::AccumulateRights()

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.


PtUser: class summary


Intro

Files to include Class declaration Base class
poet.hxx ptuser.hxx ptuser.hxx PtObject

Member functions:

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()


Intro

Declaration:

PtUser::PtUser(PtString& loginname, short userid, PtString& realname)

Description:

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.


PtUser::~PtUser()


Intro

Declaration:

virtual PtUser::~PtUser()

Description:

Destructor.


PtUser::RealName()


Intro

Declaration:

inline PtString& PtUser::RealName()

Description:

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.


PtUser::LoginName()


Intro

Declaration:

inline PtString PtUser::LoginName()

Description:

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.


PtUser::Id()


Intro

Declaration:

inline short PtUser::Id()

Description:

Returns the user's login ID by value.


PtUser::AddToGroup()


Intro

Declaration:

int PtUser::AddToGroup(PtGroup* pGroup)

Description:

Adds the user to a group.

Parameters:

PtGroup* pGroup The group to which this user should be added

Discussion:

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!


PtUser::RemoveFromGroup()


Intro

Declaration:

int PtUser::RemoveFromGroup(PtGroup* pGroup)

Description:

Adds the user to a group.

Parameters:

PtGroup* pGroup The group to which this user should be added

Discussion:

Remember to store both the user and the group after you remove an user from a group!


PtUser::IsInGroup()


Intro

Declaration:

int PtUser::IsInGroup(PtGroup* pGroup)

Description:

Determines whether the user is a member of this group.

Parameters:

PtGroup* pGroup The group we are asking about

Returns:

0 If the user is not a member of this group
non-zero If the user is a member of this group

PtUser::Groups()


Intro

Declaration:

inline PtGroupSet* PtUser::Groups()

Description:

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:

typedef cset<ondemand<PtGroup>> PtGroupSet;

Please do not change this set! Instead, use the functions AddToGroup() and RemoveFromGroup(), and POET will manage the PtGroupSet correctly.


PtUser::Store()


Intro

Declaration:

int PtUser::Store(PtDepthMode mode = PtDEEP)

Description:

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().


PtUser::UserRights()


Intro

Declaration:

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:

typedef cset<ondemand<PtRight>> PtRightSet;

PtUser::AccumulateRights()


Intro

Declaration:

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.