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 |
Files to include | Class declaration | Base class |
poet.hxx ptuser.hxx | ptrights.hxx | PtRight |
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(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)
Constructor. The rights are not assigned until you actually store the PtAttributeRight.
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.
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.
- virtual PtAttributeRight::~PtAttributeRight()
- inline void PtAttributeRight::ClearNegate()
- void* PtAttributeRight::GetFrom()
Returns a pointer to the data that specifies the starting range. You must retrieve the PtTypeId using GetTypeId() to interpret this pointer.
- inline PtWordunsigned short PtAttributeRight::GetMemberpos()
Returns the member position, relative to the scope of the object.
- inline PtClassId PtAttributeRight::GetScope()
Returns the PtClassId for the class in which the member is declared.
- void* PtAttributeRight::GetTo()
Returns a pointer to the data that specifies the ending range. You must retrieve the PtTypeId using GetTypeId() to interpret this pointer.
- inline PtTypeId PtAttributeRight::GetTypeId()
Returns the type Id for the member.
- inline int PtAttributeRight::IsNegated()
Returns non-zero if the conditions are negated.
- virtual int PtAttributeRight::Match(PtClassId &clid, PtClassId &scope, PtWordunsigned short mempos, PtTypeId typid)
Returns a non-zero value if the PtAttributeRight applies to this class, scope, and member.
- inline void PtAttributeRight::Negate()
Negates the conditions for the PtAttributeRight.
- void PtAttributeRight::SetFrom(void *)
Sets a new starting range for the PtAttributeRight.
- void PtAttributeRight::SetMemberInfo(PtClassId &scope, PtWordunsigned short MemberPos, PtTypeId)
Sets a new scope, memberpos, and type Id for the PtAttributeRight.
- void PtAttributeRight::SetTo(void *)
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.