2 --Copyright: Matra Datavision 1992,1993
4 -- File: OSD_Protection.cdl
5 -- Created: Tue 18 1992
6 -- Author: Stephan GARNAUD (ARM)
11 class Protection from OSD
13 ---Purpose: This class provides data to manage file protection
14 -- Example:These rights are treated in a system dependent manner :
15 -- On UNIX you have User,Group and Other rights
16 -- On VMS you have Owner,Group,World and System rights
17 -- An automatic conversion is done between OSD and UNIX/VMS.
23 -- System System (combined with Other)
25 -- When you use System protection on UNIX you must know that
26 -- Other rights and System rights are inclusively "ORed".
27 -- So Other with only READ access and System with WRITE access
28 -- will produce on UNIX Other with READ and WRITE access.
30 -- This choice comes from the fact that ROOT can't be considered
31 -- as member of the group nor as user. So it is considered as Other.
34 uses SingleProtection, AsciiString from TCollection
38 Create returns Protection;
39 ---Purpose: Initializes global access rights as follows
42 -- System : Read Write
48 User , Group , World : SingleProtection) returns Protection;
49 ---Purpose: Sets values of fields
53 System , User , Group , World : out SingleProtection) is static;
54 ---Purpose: Retrieves values of fields
57 SetValues (me : in out;
58 System , User , Group , World : SingleProtection) is static;
59 ---Purpose: Sets values of fields
62 SetSystem(me : in out; priv : SingleProtection) is static;
63 ---Purpose: Sets protection of 'System'
66 SetUser(me : in out; priv : SingleProtection) is static;
67 ---Purpose: Sets protection of 'User'
70 SetGroup(me : in out; priv : SingleProtection) is static;
71 ---Purpose: Sets protection of 'Group'
74 SetWorld(me : in out; priv : SingleProtection) is static;
75 ---Purpose: Sets protection of 'World'
78 System(me ) returns SingleProtection is static;
79 ---Purpose: Gets protection of 'System'
82 User(me ) returns SingleProtection is static;
83 ---Purpose: Gets protection of 'User'
86 Group(me ) returns SingleProtection is static;
87 ---Purpose: Gets protection of 'Group'
90 World(me ) returns SingleProtection is static;
91 ---Purpose: Gets protection of 'World'
94 Internal (me) returns Integer is static private;
95 ---Purpose: Returns System dependent access rights
96 -- this is a private method.
100 aProt : in out SingleProtection ;aRight : SingleProtection) is static;
101 ---Purpose: Add a right to a single protection.
103 -- me.Add(aProt,X) -> aProt = RWXD
107 aProt : in out SingleProtection ;aRight : SingleProtection) is static;
108 ---Purpose: Subtract a right to a single protection.
110 -- me.Sub(aProt,RW) -> aProt = D
111 -- But me.Sub(aProt,RWX) is also valid and gives same result.
116 s : SingleProtection; -- System right
117 u : SingleProtection; -- User right
118 g : SingleProtection; -- Group right
119 w : SingleProtection; -- World right
121 friends class FileNode, class File, class Directory
123 end Protection from OSD;