|
@@ -15,10 +15,19 @@ SimpleClassDiagrams CoreFormalism {
|
|
|
SimpleAttribute Permissions {
|
|
|
constraint = $
|
|
|
String function constraint(model : Element, name : String):
|
|
|
- if (bool_not(is_physical_string(model["model"][name]))):
|
|
|
+ Element self
|
|
|
+ self = model["model"][name]
|
|
|
+ if (bool_not(is_physical_string(self))):
|
|
|
return "Permissions has no string value"!
|
|
|
- else:
|
|
|
- return "OK"!
|
|
|
+ if (bool_not(string_len(self) == 3)):
|
|
|
+ return "Permissions string is not of correct length"!
|
|
|
+ if (bool_or(cast_s2i(string_get(self, 0)) < 0, cast_s2i(string_get(self, 0)) > 2)):
|
|
|
+ return "Owner permission is not in range [0, 2]"!
|
|
|
+ if (bool_or(cast_s2i(string_get(self, 1)) < 0, cast_s2i(string_get(self, 1)) > 2)):
|
|
|
+ return "Group permission is not in range [0, 2]"!
|
|
|
+ if (bool_or(cast_s2i(string_get(self, 2)) < 0, cast_s2i(string_get(self, 2)) > 2)):
|
|
|
+ return "Other permission is not in range [0, 2]"!
|
|
|
+ return "OK"!
|
|
|
$
|
|
|
}
|
|
|
|