Main Table of Contents


Table of Contents

class PtAttributeRight
PtAttributeRight: class summary
PtAttributeRight::PtAttributeRight()
PtAttributeRight::~PtAttributeRight()
PtAttributeRight::ClearNegate()
PtAttributeRight::GetFrom()
PtAttributeRight::GetMemberpos()
PtAttributeRight::GetScope()
PtAttributeRight::GetTo()
PtAttributeRight::GetTypeId()
PtAttributeRight::IsNegated()
PtAttributeRight::Match()
PtAttributeRight::Negate()
PtAttributeRight::SetFrom()
PtAttributeRight::SetMemberInfo()
PtAttributeRight::SetTo()
PtAttributeRight

class PtAttributeRight


Intro
PtAttributeRight: class summary
PtAttributeRight::PtAttributeRight()
PtAttributeRight::~PtAttributeRight()
PtAttributeRight::ClearNegate()
PtAttributeRight::GetFrom()
PtAttributeRight::GetMemberpos()
PtAttributeRight::GetScope()
PtAttributeRight::GetTo()
PtAttributeRight::GetTypeId()
PtAttributeRight::IsNegated()
PtAttributeRight::Match()
PtAttributeRight::Negate()
PtAttributeRight::SetFrom()
PtAttributeRight::SetMemberInfo()
PtAttributeRight::SetTo()

PtAttributeRight is a class which is used to assign rights to a class when user authorization is enabled; unlike PtClassRights, a PtAttributeRight specifies a range of values for one data member of the class, and access is granted only to those objects of the class which contain values in this range. To assign rights, simply create a PtAttributeRight, specifying the user or group and the class to which these rights should be given, then store the PtAttributeRight in the database.

To store a PtAttributeRight, you must have POETADM rights. See "User Authorization" for details.

The PtAttributeRight class is pre-registered in every POET dictionary. Here is the equivalent class declaration for PtAttributeRight:

PtAttributeRight _persistent class PtAttributeRight


PtAttributeRight: class summary


Intro

Files to include Class declaration Base class
poet.hxx ptuser.hxx ptrights.hxx PtRight

Member functions:

constructor PtAttributeRight (PtUser *, PtClassId &classreg, PtClassId &memberscope, PtWordunsigned short memberpos, PtTypeId, void *from, void *to, PtBoolunsigned short negated, PtBoolunsigned short readable, PtBoolunsigned short writable, PtBoolunsigned short deletable);
destructor virtual ~PtAttributeRight();
ClearNegate inline void ClearNegate();
GetFrom void* GetFrom();
GetMemberpos inline PtWordunsigned short GetMemberpos();
GetScope inline PtClassId GetScope();
GetTo void* GetTo();
GetTypeId inline PtTypeId GetTypeId();
IsNegated inline int IsNegated();
Match virtual int Match(PtClassId &clid, PtClassId &scope, PtWordunsigned short mempos, PtTypeId typid);
Negate inline void Negate();
SetFrom void SetFrom(void *);
SetMemberInfo void SetMemberInfo(PtClassId &scope, PtWordunsigned short MemberPos, PtTypeId);
SetTo void SetTo(void *);

PtAttributeRight::PtAttributeRight()


Intro

Declaration:

PtAttributeRight::PtAttributeRight(PtUser *, PtClassId
&classId, PtClassId &memberscope, PtWordunsigned short memberpos, PtTypeId, void *from, void *to, PtBoolunsigned short negated, PtBoolunsigned short readable, PtBoolunsigned short writable, PtBoolunsigned short deletable)

Description:

Constructor. The rights are not assigned until you actually store the PtAttributeRight.

Parameters:

PtUser* The user or group to which these rights should be granted.
PtClassId &classId The PtClassId for the class to which these rights apply.
PtClassId &memberscope The scope in which memberpos is declared.
PtWordunsigned short memberpos The position of the member in the scope in which it is declared.
PtTypeId The type manager type Id.
void *from Starting range. The value is interpreted using the PtTypeId, and the range is inclusive.
void *to Ending range. The value is interpreted using the PtTypeId, and the range is inclusive.
PtBoolunsigned short negated Negates the conditions - when this is non-zero, the rights are granted for those objects which do not match the conditions.
PtBoolUnsigned short readable Read rights to be granted
PtBoolunsigned short writable Write rights to be granted
PtBoolunsigned short deletable Delete rights to be granted

Scope is the scope in which memberpos is declared. If the member is Square:: name, the scope is the PtClassId for Square. Memberpos is always relative to the scope in which the variable is declared. If the member is Square:: name, and name is the first member declared in the Square class, memberpos is 0. Members in base classes are irrelevant; if there are 5 members in Shape, and Square is derived from Shape, memberpos is still 0 if this is the first member declared in Square.

Example:

Let's create a PtAttributeRights for Programmers whose names begin with R. We will assume that Programmer:: name is the first member of Programmer, and that it is a PtString.

// pProgrammer points to a valid Programmer
// pPerson points to a valid Person
// SuperHeroes is a group
PtString from = "R*";
PtString to = "R*";
PtAttributeRights Rights(&SuperHeroes, // user
pProgrammer->GetClassId(), // class
pPerson->GetClassId(), // scope
0, // memberpos
PtSTRING_T, // typeid
&from, // from
&to, // to
0, // !negate
1,1,1); // rights
Rights.Assign(pObjBase);
int err = Rights.Store();
check(err);

PtAttributeRight::~PtAttributeRight()


Intro

Declaration:

virtual PtAttributeRight::~PtAttributeRight()

Description:

Destructor.


PtAttributeRight::ClearNegate()


Intro

Declaration:

inline void PtAttributeRight::ClearNegate()

Description:

Clears the negated flag.


PtAttributeRight::GetFrom()


Intro

Declaration:

void* PtAttributeRight::GetFrom()

Description:

Returns a pointer to the data that specifies the starting range. You must retrieve the PtTypeId using GetTypeId() to interpret this pointer.


PtAttributeRight::GetMemberpos()


Intro

Declaration:

inline PtWordunsigned short PtAttributeRight::GetMemberpos()

Description:

Returns the member position, relative to the scope of the object.


PtAttributeRight::GetScope()


Intro

Declaration:

inline PtClassId PtAttributeRight::GetScope()

Description:

Returns the PtClassId for the class in which the member is declared.


PtAttributeRight::GetTo()


Intro

Declaration:

void* PtAttributeRight::GetTo()

Description:

Returns a pointer to the data that specifies the ending range. You must retrieve the PtTypeId using GetTypeId() to interpret this pointer.


PtAttributeRight::GetTypeId()


Intro

Declaration:

inline PtTypeId PtAttributeRight::GetTypeId()

Description:

Returns the type Id for the member.


PtAttributeRight::IsNegated()


Intro

Declaration:

inline int PtAttributeRight::IsNegated()

Description:

Returns non-zero if the conditions are negated.


PtAttributeRight::Match()


Intro

Declaration:

virtual int PtAttributeRight::Match(PtClassId &clid, PtClassId &scope, PtWordunsigned short mempos, PtTypeId typid)

Description:

Returns a non-zero value if the PtAttributeRight applies to this class, scope, and member.


PtAttributeRight::Negate()


Intro

Declaration:

inline void PtAttributeRight::Negate()

Description:

Negates the conditions for the PtAttributeRight.


PtAttributeRight::SetFrom()


Intro

Declaration:

void PtAttributeRight::SetFrom(void *)

Description:

Sets a new starting range for the PtAttributeRight.


PtAttributeRight::SetMemberInfo()


Intro

Declaration:

void PtAttributeRight::SetMemberInfo(PtClassId &scope, PtWordunsigned short MemberPos, PtTypeId)

Description:

Sets a new scope, memberpos, and type Id for the PtAttributeRight.


PtAttributeRight::SetTo()


Intro

Declaration:

void PtAttributeRight::SetTo(void *)

Description:

Sets a new ending range for the PtAttributeRight.

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.