1 -- Created on: 2018-03-15
2 -- Created by: Stephan GARNAUD (ARM)
3 -- Copyright (c) 1998-1999 Matra Datavision
4 -- Copyright (c) 1999-2014 OPEN CASCADE SAS
6 -- This file is part of Open CASCADE Technology software library.
8 -- This library is free software; you can redistribute it and/or modify it under
9 -- the terms of the GNU Lesser General Public License version 2.1 as published
10 -- by the Free Software Foundation, with special exception defined in the file
11 -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 -- distribution for complete text of the license and disclaimer of any warranty.
14 -- Alternatively, this file may be used under the terms of Open CASCADE
15 -- commercial license or contractual agreement.
17 class Protection from OSD
19 ---Purpose: This class provides data to manage file protection
20 -- Example:These rights are treated in a system dependent manner :
21 -- On UNIX you have User,Group and Other rights
22 -- On VMS you have Owner,Group,World and System rights
23 -- An automatic conversion is done between OSD and UNIX/VMS.
29 -- System System (combined with Other)
31 -- When you use System protection on UNIX you must know that
32 -- Other rights and System rights are inclusively "ORed".
33 -- So Other with only READ access and System with WRITE access
34 -- will produce on UNIX Other with READ and WRITE access.
36 -- This choice comes from the fact that ROOT can't be considered
37 -- as member of the group nor as user. So it is considered as Other.
40 uses SingleProtection, AsciiString from TCollection
44 Create returns Protection;
45 ---Purpose: Initializes global access rights as follows
48 -- System : Read Write
54 User , Group , World : SingleProtection) returns Protection;
55 ---Purpose: Sets values of fields
59 System , User , Group , World : out SingleProtection) is static;
60 ---Purpose: Retrieves values of fields
63 SetValues (me : in out;
64 System , User , Group , World : SingleProtection) is static;
65 ---Purpose: Sets values of fields
68 SetSystem(me : in out; priv : SingleProtection) is static;
69 ---Purpose: Sets protection of 'System'
72 SetUser(me : in out; priv : SingleProtection) is static;
73 ---Purpose: Sets protection of 'User'
76 SetGroup(me : in out; priv : SingleProtection) is static;
77 ---Purpose: Sets protection of 'Group'
80 SetWorld(me : in out; priv : SingleProtection) is static;
81 ---Purpose: Sets protection of 'World'
84 System(me ) returns SingleProtection is static;
85 ---Purpose: Gets protection of 'System'
88 User(me ) returns SingleProtection is static;
89 ---Purpose: Gets protection of 'User'
92 Group(me ) returns SingleProtection is static;
93 ---Purpose: Gets protection of 'Group'
96 World(me ) returns SingleProtection is static;
97 ---Purpose: Gets protection of 'World'
100 Internal (me) returns Integer is static private;
101 ---Purpose: Returns System dependent access rights
102 -- this is a private method.
106 aProt : in out SingleProtection ;aRight : SingleProtection) is static;
107 ---Purpose: Add a right to a single protection.
109 -- me.Add(aProt,X) -> aProt = RWXD
113 aProt : in out SingleProtection ;aRight : SingleProtection) is static;
114 ---Purpose: Subtract a right to a single protection.
116 -- me.Sub(aProt,RW) -> aProt = D
117 -- But me.Sub(aProt,RWX) is also valid and gives same result.
122 s : SingleProtection; -- System right
123 u : SingleProtection; -- User right
124 g : SingleProtection; -- Group right
125 w : SingleProtection; -- World right
127 friends class FileNode, class File, class Directory
129 end Protection from OSD;