b311480e |
1 | -- Created on: 2018-03-15 |
2 | -- Created by: Stephan GARNAUD (ARM) |
3 | -- Copyright (c) 1998-1999 Matra Datavision |
973c2be1 |
4 | -- Copyright (c) 1999-2014 OPEN CASCADE SAS |
b311480e |
5 | -- |
973c2be1 |
6 | -- This file is part of Open CASCADE Technology software library. |
b311480e |
7 | -- |
d5f74e42 |
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 |
973c2be1 |
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. |
b311480e |
13 | -- |
973c2be1 |
14 | -- Alternatively, this file may be used under the terms of Open CASCADE |
15 | -- commercial license or contractual agreement. |
7fd59977 |
16 | |
17 | class Protection from OSD |
18 | |
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. |
24 | -- |
25 | -- OSD VMS UNIX |
26 | -- User Owner User |
27 | -- Group Group Group |
28 | -- World World Other |
29 | -- System System (combined with Other) |
30 | -- |
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. |
35 | -- |
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. |
38 | |
39 | |
40 | uses SingleProtection, AsciiString from TCollection |
41 | |
42 | |
43 | is |
44 | Create returns Protection; |
45 | ---Purpose: Initializes global access rights as follows |
46 | -- |
47 | -- User : Read Write |
48 | -- System : Read Write |
49 | -- Group : Read |
50 | -- World : Read |
51 | ---Level: Public |
52 | |
53 | Create (System , |
54 | User , Group , World : SingleProtection) returns Protection; |
55 | ---Purpose: Sets values of fields |
56 | ---Level: Public |
57 | |
58 | Values (me : in out; |
59 | System , User , Group , World : out SingleProtection) is static; |
60 | ---Purpose: Retrieves values of fields |
61 | ---Level: Public |
62 | |
63 | SetValues (me : in out; |
64 | System , User , Group , World : SingleProtection) is static; |
65 | ---Purpose: Sets values of fields |
66 | ---Level: Public |
67 | |
68 | SetSystem(me : in out; priv : SingleProtection) is static; |
69 | ---Purpose: Sets protection of 'System' |
70 | ---Level: Public |
71 | |
72 | SetUser(me : in out; priv : SingleProtection) is static; |
73 | ---Purpose: Sets protection of 'User' |
74 | ---Level: Public |
75 | |
76 | SetGroup(me : in out; priv : SingleProtection) is static; |
77 | ---Purpose: Sets protection of 'Group' |
78 | ---Level: Public |
79 | |
80 | SetWorld(me : in out; priv : SingleProtection) is static; |
81 | ---Purpose: Sets protection of 'World' |
82 | ---Level: Public |
83 | |
84 | System(me ) returns SingleProtection is static; |
85 | ---Purpose: Gets protection of 'System' |
86 | ---Level: Public |
87 | |
88 | User(me ) returns SingleProtection is static; |
89 | ---Purpose: Gets protection of 'User' |
90 | ---Level: Public |
91 | |
92 | Group(me ) returns SingleProtection is static; |
93 | ---Purpose: Gets protection of 'Group' |
94 | ---Level: Public |
95 | |
96 | World(me ) returns SingleProtection is static; |
97 | ---Purpose: Gets protection of 'World' |
98 | ---Level: Public |
99 | |
100 | Internal (me) returns Integer is static private; |
101 | ---Purpose: Returns System dependent access rights |
102 | -- this is a private method. |
103 | ---Level: Public |
104 | |
105 | Add (me : in out ; |
106 | aProt : in out SingleProtection ;aRight : SingleProtection) is static; |
107 | ---Purpose: Add a right to a single protection. |
108 | -- ex: aProt = RWD |
109 | -- me.Add(aProt,X) -> aProt = RWXD |
110 | ---Level: Public |
111 | |
112 | Sub (me : in out ; |
113 | aProt : in out SingleProtection ;aRight : SingleProtection) is static; |
114 | ---Purpose: Subtract a right to a single protection. |
115 | -- ex: aProt = RWD |
116 | -- me.Sub(aProt,RW) -> aProt = D |
117 | -- But me.Sub(aProt,RWX) is also valid and gives same result. |
118 | ---Level: Public |
119 | |
120 | |
121 | fields |
122 | s : SingleProtection; -- System right |
123 | u : SingleProtection; -- User right |
124 | g : SingleProtection; -- Group right |
125 | w : SingleProtection; -- World right |
126 | |
127 | friends class FileNode, class File, class Directory |
128 | |
129 | end Protection from OSD; |
130 | |
131 | |