Download GemStone/S Programming Guide

Transcript
Object Security and Authorization
How GemStone Security Works
Because segments are objects, access to a segment object is controlled by the
segment it is assigned to, exactly like access to any other object. Segment objects
are usually assigned to the DataCurator segment. The access information stored in
the segment object’s own authorizations instance variable, which controls access to
the objects assigned to that segment, does not control access to the segment object
itself.
Objects do not “belong” to a segment. It is more correct to say that objects are
associated with a segment. Although objects know which segment they are
assigned to, segments do not know which objects are assigned to them. Segments
are not meant to organize objects for easy listing and retrieval. For those purposes,
you must turn to symbol lists, which are described in Chapter 3, “Resolving
Names and Sharing Objects“.
Default Segment and Current Segment
You are assigned a default segment as part of your UserProfile. When you login to
GemStone, your Session uses this default segment as your current segment. Any
objects you create are assigned to your current segment.
Class UserProfile has the message defaultSegment, which returns your default
Segment. Sending the message currentSegment: to System changes your
current segment:
Example 7.1
| aSegment mySegment |
mySegment := System myUserProfile defaultSegment.
aSegment := Segment newInRepository: SystemRepository.
"change my current segment to aSegment"
System currentSegment: aSegment
If you commit after changing segments, the new segment remains your current
segment until you change the segment or log out. If you abort after changing your
current segment, your current segment is reset from the UserProfile’s default
segment. If the segment has already been committed, the abort operation has no
effect on segment assignment.
Unnamed segments are often stored in a UserProfile, but named segments are
stored in symbol dictionaries like other named objects. Private segments are
typically kept in a user’s UserGlobals dictionary; segments for groups of users are
typically kept in a shared dictionary.
December 2001
GemStone Systems, Inc.
7-5