-
Notifications
You must be signed in to change notification settings - Fork 1
/
base-model.txt
1249 lines (1188 loc) · 58 KB
/
base-model.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Copyright (c) 2018 Ilya Shchepetkov <shchepetkov@ispras.ru>
// Copyright (c) 2018 ISP RAS (http://www.ispras.ru)
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
context C1
sets
Union // Artificial set of all possible elements of the model
Names // Set of all possible names for entities and roles
Accesses // Set of all possible accesses
AccessRights // Set of all possible access rights (permissions)
constants
Root // Linux "/" root directory
SRoot // Artificial root process - doesn't exist in the real OS
SpecialAdmRoles // Set of special administrative roles
EntitiesAR // Role from the SAR set
SubjectsAR // -
UsersAR // -
RolesAR // -
ARolesAR // -
ReadA // Read access
WriteA // Write access
Read // Read access right
Write // Write access right
Execute // Execute access right
Own // Own access right
CommonRole // Role that is common for all user accounts
axioms
@UnionIsFinite
finite(Union)
@RootType
Root ∈ Union
@SRootType
SRoot ∈ Union
@SpecialAdmRolesType
SpecialAdmRoles ⊆ Union
@SpecialAdmRolesContent
partition(SpecialAdmRoles, {EntitiesAR}, {SubjectsAR}, {UsersAR}, {RolesAR}, {ARolesAR})
@SpecialAdmRolesAreFinite
finite(SpecialAdmRoles)
@AccessesPartition
partition(Accesses, {ReadA}, {WriteA})
@AccessRightsPartition
partition(AccessRights, {Read}, {Write}, {Execute}, {Own})
@CommonRoleType
CommonRole ∈ Union
@InductionAxiom
∀s · s ⊆ ℕ ∧ 0 ∈ s ∧ (∀n · n ∈ s ⇒ n + 1 ∈ s) ⇒ ℕ ⊆ s
end
machine M1
sees C1
variables
CurrUnion
UserAccs // Set of all current user accounts
Subjects // Set of all current subjects (processes)
Entities // Set of all current entities (files and file-like objects, directories)
Objects // Set of all current objects (files), subset of Entities
Containers // Set of all current containers (directories), subset of Entities
Roles // Set of all current roles
OrdRoles // Set of all current ordinary roles, subset of Roles
AdmRoles // Set of all current administrative roles, subset of Roles
Direct // Function. For a given entity returns False if it has a mount point (For example, it has a mount point if it is located on the flash drive)
EntityMP // Function. For a given entity returns its mount point in the file system
EntityNames // Like function Parent below, but returns the name, under which the file is contained in the container, and the parent container itself.
Parent // Function. Hierarchy of entities in the file system, for each entity except the root directory function returns its parent container.
RoleAdmRights // Function. Current access rights of administrative roles to roles
RoleName // Function. Stores role names.
RoleRights // Function. Current access rights of roles to entities
RParents // Function. Hierarchy of roles, for each role returns the set of its parent roles.
Shared // Function. Sets an additional flag to each entity and role.
SParent // Function. Same as Parent, but for subjects
SubjectAccesses // Function. Current accesses of subjects to entities
SubjectAdmAccesses // Function. Current accesses of subjects to roles
SubjectOwner // Function. Stores an owner (role) of some subjects
SubjectUser // Function. Stores an user account on which behalf the subject (process) is executed
UserAdmRole // Function. Stores an individual administrative role of each user account.
UserOrdRole // Function. Stores an individual ordinary role of each user account.
invariants
@CurrUnionType
CurrUnion ⊆ Union
@CurrUnionPartition
partition(CurrUnion, UserAccs, Subjects, Entities, Roles)
@EntitiesPartition
partition(Entities, Objects, Containers)
@RolesPartition
partition(Roles, AdmRoles, OrdRoles)
@CommonRoleType
CommonRole ∈ OrdRoles
@DirectType
Direct ∈ Entities ∪ Roles → BOOL
@EntityMPType
EntityMP ∈ Entities → Containers
@EntityNamesType
EntityNames ∈ Entities ∖ {Root} → (Containers ↔ Names)
@ParentType
Parent ∈ Containers ∖ {Root} → Containers
@RoleAdmRightsType
RoleAdmRights ∈ AdmRoles → (Roles ↔ AccessRights)
@RoleNameType
RoleName ∈ Roles ↣ Names
@RoleRightsType
RoleRights ∈ Roles → (Entities ↔ AccessRights)
@RootType
Root ∈ Containers
@RParentsType
RParents ∈ Roles → ℙ(Roles)
@SharedType
Shared ∈ Containers ∪ Roles → BOOL
@SParentType
SParent ∈ Subjects ∖ {SRoot} → Subjects
@SpecialAdmRolesTypes
SpecialAdmRoles ⊆ AdmRoles
@SRootType
SRoot ∈ Subjects
@SubjectAccessesType
SubjectAccesses ∈ Subjects → (Entities ↔ Accesses)
@SubjectAdmAccessesType
SubjectAdmAccesses ∈ Subjects → (Roles ↔ Accesses)
@SubjectOwnerType
SubjectOwner ∈ Subjects ⇸ Roles
@SubjectUserType
SubjectUser ∈ Subjects → UserAccs
@UserAdmRoleType
UserAdmRole ∈ UserAccs → AdmRoles
@UserOrdRoleType
UserOrdRole ∈ UserAccs → OrdRoles
@UserAccsAreNotEmpty
UserAccs ≠ ∅
@SubjectsAreNotEmpty
Subjects ≠ ∅
@EntityNames1
∀e · e ∈ dom(EntityNames) ⇒ EntityNames(e) ≠ ∅
@EntityNames2
∀c · c ∈ Containers ∧ c ≠ Root ⇒ (∃p, n · p ∈ Containers ∧ n ∈ Names ∧ EntityNames(c) = {p ↦ n})
@EntityNames3
∀e1, e2 · e1 ∈ dom(EntityNames) ∧ e2 ∈ dom(EntityNames) ∧ e1 ≠ e2 ⇒ EntityNames(e1) ∩ EntityNames(e2) = ∅
@EntityNames4
∀c1, c2 · c1 ∈ Containers ∧ c1 ≠ Root ∧ c2 ∈ dom(EntityNames(c1)) ⇒ c2 = Parent(c1)
@EntityNames5
∀c1, c2 · c1 ∈ Containers ∧ c1 ≠ Root ∧ c2 = Parent(c1) ⇒ c2 ∈ dom(EntityNames(c1))
@RParents1
∀r · r ∈ AdmRoles ⇒ RParents(r) ⊆ AdmRoles
@RParents2
∀r · r ∈ OrdRoles ⇒ RParents(r) ⊆ OrdRoles
@NoCyclesForContainers
∀C · C ⊆ Containers ∧ C ≠ ∅ ∧ Root ∉ C ⇒ C ∖ Parent[C] ≠ ∅
@NoCyclesForRoles
∀R · R ⊆ Roles ∧ R ≠ ∅ ⇒ (∃r · r ∈ R ∧ (∀p · p ∈ R ⇒ p ∉ RParents(r)))
@NoCyclesForSubjects
∀S · S ⊆ dom(SParent) ∧ S ≠ ∅ ⇒ S ∖ SParent[S] ≠ ∅
@RolesAreShared
∀r · r ∈ Roles ⇒ Shared(r) = TRUE
@ExecuteToEverything
∀ar, r · ar ∈ AdmRoles ∧ r ∈ Roles ⇒ r ↦ Execute ∈ RoleAdmRights(ar)
@RolesAR1
∀r · r ∈ OrdRoles ⇒ r ↦ Own ∈ RoleAdmRights(RolesAR)
@RolesAR2
∀r, ar · r ∈ OrdRoles ∧ ar ∈ AdmRoles ∧ r ↦ Own ∈ RoleAdmRights(ar) ⇒ ar = RolesAR
@ARolesAR1
∀r · r ∈ AdmRoles ⇒ r ↦ Own ∈ RoleAdmRights(ARolesAR)
@ARolesAR2
∀r, ar · r ∈ AdmRoles ∧ ar ∈ AdmRoles ∧ r ↦ Own ∈ RoleAdmRights(ar) ⇒ ar = ARolesAR
@NoMultipleOwners
∀r1, r2, e · r1 ∈ Roles ∧ r2 ∈ Roles ∧ e ↦ Own ∈ RoleRights(r1) ∧ e ↦ Own ∈ RoleRights(r2) ⇒ r1 = r2
@ReadSpreads
∀ar, r, p · ar ∈ AdmRoles ∧ r ∈ Roles ∧ p ∈ Roles
∧ p ∈ RParents(r) ∧ p ↦ Read ∈ RoleAdmRights(ar)
⇒ r ↦ Read ∈ RoleAdmRights(ar)
@Direct1
∀e · e ∈ Entities ∧ Direct(e) = TRUE ⇒ EntityMP(e) = Root
@Direct2
∀e · e ∈ Entities ∧ Direct(e) = FALSE ⇒ Direct(EntityMP(e)) = TRUE
@Direct3
∀c · c ∈ Containers ∧ Direct(c) = FALSE ⇒ c ∉ ran(EntityMP)
@Direct4
∀e, p · e ∈ dom(EntityNames) ∧ p ∈ dom(EntityNames(e)) ∧ Direct(p) = FALSE ⇒ Direct(e) = FALSE
@Direct5
∀e, mp · e ∈ dom(EntityNames) ∧ mp ∈ dom(EntityNames(e)) ∧ Direct(mp) = TRUE ∧ Direct(e) = FALSE
⇒ (∀child · child ∈ dom(EntityNames) ∧ mp ∈ dom(EntityNames(child)) ⇒ Direct(child) = FALSE)
@Direct6
∀e, p · e ∈ dom(EntityNames) ∧ p ∈ dom(EntityNames(e)) ∧ Direct(e) = FALSE
⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {p} = E ∪ {Root} ∧ EntityMP(e) ∈ E ∪ {Root})
@Direct7
Direct(Root) = TRUE
@Direct8
∀e, a, r · e ∈ Entities ∧ Direct(e) = FALSE ∧ r ∈ Roles ∧ a ∈ AccessRights ∧ e ↦ a ∈ RoleRights(r)
⇒ EntityMP(e) ↦ a ∈ RoleRights(r)
@Direct9
∀e, a, r · e ∈ Entities ∧ Direct(e) = FALSE ∧ r ∈ Roles ∧ a ∈ AccessRights ∧ EntityMP(e) ↦ a ∈ RoleRights(r)
⇒ e ↦ a ∈ RoleRights(r)
@Direct10
∀e, p · e ∈ dom(EntityNames) ∧ p ∈ dom(EntityNames(e)) ∧ Direct(e) = FALSE ∧ Direct(p) = FALSE
⇒ EntityMP(e) = EntityMP(p)
@Direct11
∀e, p · e ∈ dom(EntityNames) ∧ p ∈ dom(EntityNames(e)) ∧ Direct(e) = FALSE ∧ Direct(p) = TRUE
⇒ EntityMP(e) = p
@Direct12
∀r · r ∈ Roles ⇒ Direct(r) = TRUE
@UserAdmRole1
∀u · u ∈ UserAccs ⇒ RParents(UserAdmRole(u)) = ∅
@UserAdmRole2
∀u, r · u ∈ UserAccs ∧ r ∈ Roles ⇒ UserAdmRole(u) ∉ RParents(r)
@UserAdmRole3
∀u1, u2 · u1 ∈ UserAccs ∧ u2 ∈ UserAccs ∧ u1 ≠ u2 ⇒ UserAdmRole(u1) ≠ UserAdmRole(u2)
@UserAdmRole4
∀u · u ∈ UserAccs ⇒ UserAdmRole(u) ∉ SpecialAdmRoles
@UserAdmRole5
∀u · u ∈ UserAccs ⇒ UserAdmRole(u) ↦ Read ∈ RoleAdmRights(UserAdmRole(u))
@UserAdmRole6
∀u · u ∈ UserAccs ⇒ UserAdmRole(u) ↦ Write ∈ RoleAdmRights(UserAdmRole(u))
@UserOrdRole1
∀u · u ∈ UserAccs ⇒ RParents(UserOrdRole(u)) = ∅
@UserOrdRole2
∀u, r · u ∈ UserAccs ∧ r ∈ Roles ⇒ UserOrdRole(u) ∉ RParents(r)
@UserOrdRole3
∀u1, u2 · u1 ∈ UserAccs ∧ u2 ∈ UserAccs ∧ u1 ≠ u2 ⇒ UserOrdRole(u1) ≠ UserOrdRole(u2)
@UserOrdRole4
∀u · u ∈ UserAccs ⇒ UserOrdRole(u) ↦ Read ∈ RoleAdmRights(UserAdmRole(u))
@UserOrdRole5
∀u · u ∈ UserAccs ⇒ UserOrdRole(u) ↦ Write ∈ RoleAdmRights(UserAdmRole(u))
@CommonRole1
RParents(CommonRole) = ∅
@CommonRole2
∀r · r ∈ Roles ⇒ CommonRole ∉ RParents(r)
@CommonRole3
∀u · u ∈ UserAccs ⇒ CommonRole ≠ UserOrdRole(u)
@CommonRole4
∀u · u ∈ UserAccs ⇒ CommonRole ↦ Read ∈ RoleAdmRights(UserAdmRole(u))
@CommonRole5
∀u · u ∈ UserAccs ⇒ CommonRole ↦ Write ∈ RoleAdmRights(UserAdmRole(u))
events
event INITIALISATION
then
@act1 CurrUnion ≔ ∅
@act2 UserAccs ≔ ∅
@act3 Subjects ≔ ∅
@act4 Entities ≔ ∅
@act5 Objects ≔ ∅
@act6 Containers ≔ ∅
@act7 Roles ≔ ∅
@act8 OrdRoles ≔ ∅
@act9 AdmRoles ≔ ∅
@act10 Direct ≔ ∅
@act11 EntityMP ≔ ∅
@act12 EntityNames ≔ ∅
@act13 Parent ≔ ∅
@act14 RoleAdmRights ≔ ∅
@act15 RoleName ≔ ∅
@act16 RoleRights ≔ ∅
@act17 RParents ≔ ∅
@act18 Shared ≔ ∅
@act19 SParent ≔ ∅
@act20 SubjectAccesses ≔ ∅
@act21 SubjectAdmAccesses ≔ ∅
@act22 SubjectOwner ≔ ∅
@act23 SubjectUser ≔ ∅
@act24 UserAdmRole ≔ ∅
@act25 UserOrdRole ≔ ∅
end
event create_user
any
user
subject
userOrdRole
userAdmRole
roles
roleAdmRights
roleName
roleRights
rParents
where
@grd1 user ∈ Union ∖ CurrUnion
@grd2 subject ∈ Subjects
@grd3 UsersAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd4 RolesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd5 RolesAR ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd6 ARolesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd7 ARolesAR ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd8 userOrdRole ∈ (Union ∖ CurrUnion) ∖ {user}
@grd9 userAdmRole ∈ (Union ∖ CurrUnion) ∖ {user}
@grd10 partition(roles, {userOrdRole}, {userAdmRole})
@grd11 roleAdmRights ∈ AdmRoles ∪ {userAdmRole} → (Roles ∪ roles ↔ AccessRights)
@grd12 ∀r1, ar, r2 · r1 ∈ Roles ∧ r2 ∈ AdmRoles ∧ ar ∈ AccessRights ∧ r1 ↦ ar ∈ RoleAdmRights(r2)
⇒ r1 ↦ ar ∈ roleAdmRights(r2)
@grd13 ∀r1, ar, r2 · r1 ∈ Roles ∧ r2 ∈ AdmRoles ∧ ar ∈ AccessRights ∧ r1 ↦ ar ∈ roleAdmRights(r2)
⇒ r1 ↦ ar ∈ RoleAdmRights(r2)
@grd14 userAdmRole ↦ Own ∈ roleAdmRights(ARolesAR)
@grd15 userAdmRole ↦ Own ∉ roleAdmRights(RolesAR)
@grd16 userOrdRole ↦ Own ∈ roleAdmRights(RolesAR)
@grd17 userOrdRole ↦ Own ∉ roleAdmRights(ARolesAR)
@grd18 ∀ar, r · ar ∈ AdmRoles ∖ {RolesAR, ARolesAR} ∧ r ∈ roles
⇒ r ↦ Own ∉ roleAdmRights(ar)
@grd19 ∀r · r ∈ Roles ∪ roles ⇒ r ↦ Own ∉ roleAdmRights(userAdmRole)
@grd20 ∀r · r ∈ Roles ∪ roles ⇒ r ↦ Execute ∈ roleAdmRights(userAdmRole)
@grd21 ∀r, ar · r ∈ roles ∧ ar ∈ AdmRoles ⇒ r ↦ Execute ∈ roleAdmRights(ar)
@grd22 ∀r · r ∈ Roles ∧ r ≠ CommonRole ⇒ r ↦ Read ∉ roleAdmRights(userAdmRole)
@grd23 ∀r · r ∈ Roles ∧ r ≠ CommonRole ⇒ r ↦ Write ∉ roleAdmRights(userAdmRole)
@grd24 ∀r, ar · r ∈ roles ∧ ar ∈ AdmRoles ⇒ r ↦ Read ∉ roleAdmRights(ar)
@grd25 ∀r, ar · r ∈ roles ∧ ar ∈ AdmRoles ⇒ r ↦ Write ∉ roleAdmRights(ar)
@grd26 userOrdRole ↦ Read ∈ roleAdmRights(userAdmRole)
@grd27 userAdmRole ↦ Read ∈ roleAdmRights(userAdmRole)
@grd28 CommonRole ↦ Read ∈ roleAdmRights(userAdmRole)
@grd29 userOrdRole ↦ Write ∈ roleAdmRights(userAdmRole)
@grd30 userAdmRole ↦ Write ∈ roleAdmRights(userAdmRole)
@grd31 CommonRole ↦ Write ∈ roleAdmRights(userAdmRole)
@grd32 roleName ∈ roles → Names
@grd33 roleName(userOrdRole) ≠ roleName(userAdmRole)
@grd34 ∀r1, r2 · r1 ∈ roles ∧ r2 ∈ Roles ⇒ roleName(r1) ≠ RoleName(r2)
@grd35 roleRights ∈ roles → (Entities ↔ AccessRights)
@grd36 ∀r · r ∈ roles ⇒ roleRights(r) = ∅
@grd37 rParents ∈ roles → ℙ(roles)
@grd38 ∀r · r ∈ roles ⇒ rParents(r) = ∅
then
@act1 CurrUnion ≔ CurrUnion ∪ {user} ∪ roles
@act2 UserAccs ≔ UserAccs ∪ {user}
@act3 Roles ≔ Roles ∪ roles
@act4 OrdRoles ≔ OrdRoles ∪ {userOrdRole}
@act5 AdmRoles ≔ AdmRoles ∪ {userAdmRole}
@act6 UserOrdRole(user) ≔ userOrdRole
@act7 UserAdmRole(user) ≔ userAdmRole
@act8 RoleAdmRights ≔ roleAdmRights
@act9 RoleRights ≔ RoleRights ∪ roleRights
@act10 Direct ≔ Direct ∪ {x ↦ y ∣ x ∈ roles ∧ y = TRUE}
@act11 Shared ≔ Shared ∪ {x ↦ y ∣ x ∈ roles ∧ y = TRUE}
@act12 RoleName ≔ RoleName ∪ roleName
@act13 RParents ≔ RParents ∪ rParents
end
event get_user_attr
any
subject
user
object
where
@grd1 subject ∈ Subjects
@grd2 user ∈ UserAccs
@grd3 object ∈ Objects
@grd4 object ↦ WriteA ∈ SubjectAccesses(subject)
end
event delete_user
any
user
subject
roles
subjectAdmAccesses
rParents
roleAdmRights
where
@grd1 user ∈ UserAccs
@grd2 subject ∈ Subjects
@grd3 ∀s · s ∈ Subjects ⇒ SubjectUser(s) ≠ user
@grd4 UsersAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd5 RolesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd6 ARolesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd7 roles = {UserAdmRole(user), UserOrdRole(user)}
@grd8 subjectAdmAccesses ∈ Subjects → (Roles ∖ roles ↔ Accesses)
@grd9 ∀s · s ∈ Subjects ⇒ subjectAdmAccesses(s) = roles ⩤ SubjectAdmAccesses(s)
@grd10 rParents ∈ Roles ∖ roles → ℙ(Roles ∖ roles)
@grd11 ∀r · r ∈ Roles ∧ r ∉ roles ⇒ rParents(r) = RParents(r) ∖ roles
@grd12 roleAdmRights ∈ AdmRoles ∖ roles → (Roles ∖ roles ↔ AccessRights)
@grd13 ∀r · r ∈ AdmRoles ∧ r ∉ roles ⇒ roleAdmRights(r) = roles ⩤ RoleAdmRights(r)
then
@act1 CurrUnion ≔ (CurrUnion ∖ {user}) ∖ roles
@act2 UserAccs ≔ UserAccs ∖ {user}
@act3 Roles ≔ Roles ∖ roles
@act4 AdmRoles ≔ AdmRoles ∖ {UserAdmRole(user)}
@act5 OrdRoles ≔ OrdRoles ∖ {UserOrdRole(user)}
@act6 UserAdmRole ≔ {user} ⩤ UserAdmRole
@act7 UserOrdRole ≔ {user} ⩤ UserOrdRole
@act8 RoleRights ≔ roles ⩤ RoleRights
@act9 RoleName ≔ roles ⩤ RoleName
@act10 SubjectOwner ≔ SubjectOwner ⩥ roles
@act11 Shared ≔ roles ⩤ Shared
@act12 SubjectAdmAccesses ≔ subjectAdmAccesses
@act13 RParents ≔ rParents
@act14 RoleAdmRights ≔ roleAdmRights
@act15 Direct ≔ roles ⩤ Direct
@act16 SubjectUser ≔ SubjectUser ⩥ {user}
end
event create_object
any
subject
object
parent
name
role
dLabel
mountPoint
roleRights
depth
where
@grd1 object ∈ Union ∖ CurrUnion
@grd2 subject ∈ Subjects
@grd3 parent ∈ Containers
@grd4 parent ↦ WriteA ∈ SubjectAccesses(subject)
@grd5 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ parent ↦ Execute ∈ RoleRights(r)
@grd6 name ∈ Names
@grd7 ∀e · e ∈ dom(EntityNames) ⇒ parent ↦ name ∉ EntityNames(e)
@grd8 role = UserOrdRole(SubjectUser(subject))
@grd9 role ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd10 mountPoint ∈ Containers
@grd11 dLabel ∈ BOOL
@grd12 ∀e · e ∈ dom(EntityNames) ∧ parent ∈ dom(EntityNames(e)) ⇒ Direct(e) = dLabel
@grd13 dLabel = TRUE ⇒ Direct(parent) = TRUE
@grd14 dLabel = TRUE ⇒ mountPoint = Root
@grd15 dLabel = FALSE ∧ Direct(parent) = FALSE ⇒ mountPoint = EntityMP(parent)
@grd16 dLabel = FALSE ∧ Direct(parent) = TRUE ⇒ mountPoint = parent
@grd17 roleRights ∈ Roles → (Entities ∪ {object} ↔ AccessRights)
@grd18 ∀e, a, r · e ∈ Entities ∧ a ∈ AccessRights ∧ r ∈ Roles ⇒ (e ↦ a ∈ roleRights(r) ⇔ e ↦ a ∈ RoleRights(r))
@grd19 dLabel = TRUE ⇒ object ↦ Own ∈ roleRights(role)
@grd20 dLabel = TRUE ⇒ (∀a, r · a ∈ AccessRights ∧ r ∈ Roles ∧ object ↦ a ∈ roleRights(r) ⇒ a = Own ∧ r = role)
@grd21 dLabel = FALSE ⇒ (∀a, r · a ∈ AccessRights ∧ r ∈ Roles ⇒ (mountPoint ↦ a ∈ RoleRights(r) ⇔ object ↦ a ∈ roleRights(r)))
@grd22 depth ∈ ℕ → ℙ(Containers)
@grd23 ∀c · c ∈ Containers ⇒ (∃i · i ∈ ℕ ∧ c ∈ depth(i))
@grd24 depth(0) = {Root}
@grd25 ∀i · i ∈ ℕ ∧ i ≠ 0 ⇒ (∀c · c ∈ depth(i) ⇒ c ≠ Root)
@grd26 ∀i · i ∈ ℕ ⇒ (∀c · c ∈ depth(i + 1) ⇒ (∃p · p ∈ depth(i) ∧ p = Parent(c)))
theorem @grd27 ∀i · i ∈ ℕ ∧ (∀c · c ∈ depth(i) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
⇒ (∀c · c ∈ depth(i + 1) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
theorem @grd28 ∀i · i ∈ ℕ ⇒ (∀c · c ∈ depth(i) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
then
@act1 CurrUnion ≔ CurrUnion ∪ {object}
@act2 Entities ≔ Entities ∪ {object}
@act3 Objects ≔ Objects ∪ {object}
@act4 EntityNames(object) ≔ {parent ↦ name}
@act5 RoleRights ≔ roleRights
@act6 Direct(object) ≔ dLabel
@act7 EntityMP(object) ≔ mountPoint
end
event create_container
any
subject
container
parent
name
role
dLabel
mountPoint
roleRights
depth
where
@grd1 container ∈ Union ∖ CurrUnion
@grd2 subject ∈ Subjects
@grd3 parent ∈ Containers
@grd4 parent ↦ WriteA ∈ SubjectAccesses(subject)
@grd5 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ parent ↦ Execute ∈ RoleRights(r)
@grd6 name ∈ Names
@grd7 ∀e · e ∈ dom(EntityNames) ⇒ parent ↦ name ∉ EntityNames(e)
@grd8 role = UserOrdRole(SubjectUser(subject))
@grd9 role ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd10 mountPoint ∈ Containers
@grd11 dLabel ∈ BOOL
@grd12 ∀e · e ∈ dom(EntityNames) ∧ parent ∈ dom(EntityNames(e)) ⇒ Direct(e) = dLabel
@grd13 dLabel = TRUE ⇒ Direct(parent) = TRUE
@grd14 dLabel = TRUE ⇒ mountPoint = Root
@grd15 dLabel = FALSE ∧ Direct(parent) = FALSE ⇒ mountPoint = EntityMP(parent)
@grd16 dLabel = FALSE ∧ Direct(parent) = TRUE ⇒ mountPoint = parent
@grd17 roleRights ∈ Roles → (Entities ∪ {container} ↔ AccessRights)
@grd18 ∀e, a, r · e ∈ Entities ∧ a ∈ AccessRights ∧ r ∈ Roles ⇒ (e ↦ a ∈ roleRights(r) ⇔ e ↦ a ∈ RoleRights(r))
@grd19 dLabel = TRUE ⇒ container ↦ Own ∈ roleRights(role)
@grd20 dLabel = TRUE ⇒ (∀a, r · a ∈ AccessRights ∧ r ∈ Roles ∧ container ↦ a ∈ roleRights(r) ⇒ a = Own ∧ r = role)
@grd21 dLabel = FALSE ⇒ (∀a, r · a ∈ AccessRights ∧ r ∈ Roles ⇒ (mountPoint ↦ a ∈ RoleRights(r) ⇔ container ↦ a ∈ roleRights(r)))
@grd22 depth ∈ ℕ → ℙ(Containers)
@grd23 ∀c · c ∈ Containers ⇒ (∃i · i ∈ ℕ ∧ c ∈ depth(i))
@grd24 depth(0) = {Root}
@grd25 ∀i · i ∈ ℕ ∧ i ≠ 0 ⇒ (∀c · c ∈ depth(i) ⇒ c ≠ Root)
@grd26 ∀i · i ∈ ℕ ⇒ (∀c · c ∈ depth(i + 1) ⇒ (∃p · p ∈ depth(i) ∧ p = Parent(c)))
theorem @grd27 ∀i · i ∈ ℕ ∧ (∀c · c ∈ depth(i) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
⇒ (∀c · c ∈ depth(i + 1) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
theorem @grd28 ∀i · i ∈ ℕ ⇒ (∀c · c ∈ depth(i) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
then
@act1 CurrUnion ≔ CurrUnion ∪ {container}
@act2 Entities ≔ Entities ∪ {container}
@act3 Containers ≔ Containers ∪ {container}
@act4 Shared(container) ≔ FALSE
@act5 Parent(container) ≔ parent
@act6 EntityNames(container) ≔ {parent ↦ name}
@act7 RoleRights ≔ roleRights
@act8 Direct(container) ≔ dLabel
@act9 EntityMP(container) ≔ mountPoint
end
event set_entity_labels
any
roleRights
where
@grd1 roleRights ∈ Roles → (Entities ↔ AccessRights)
@grd2 ∀r1, r2, e · r1 ∈ Roles ∧ r2 ∈ Roles ∧ e ↦ Own ∈ roleRights(r1) ∧ e ↦ Own ∈ roleRights(r2) ⇒ r1=r2
@grd3 ∀e, a, r · e ∈ Entities ∧ Direct(e) = FALSE ∧ r ∈ Roles ∧ a ∈ AccessRights ∧ e ↦ a ∈ roleRights(r)
⇒ EntityMP(e) ↦ a ∈ roleRights(r)
@grd4 ∀e, a, r · e ∈ Entities ∧ Direct(e) = FALSE ∧ r ∈ Roles ∧ a ∈ AccessRights ∧ EntityMP(e) ↦ a ∈ roleRights(r)
⇒ e ↦ a ∈ roleRights(r)
then
@act1 RoleRights ≔ roleRights
end
event set_entity_owner
any
subject
owner
oldOwner
entity
roleRights
where
@grd1 subject ∈ Subjects
@grd2 entity ∈ Entities
@grd3 owner ∈ Roles
@grd4 oldOwner ∈ Roles
@grd5 owner ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd6 EntitiesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd7 (oldOwner ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ oldOwner ↦ WriteA ∈ SubjectAdmAccesses(subject)
∧ entity ↦ Own ∈ RoleRights(oldOwner))
∨ (∀r · r ∈ Roles ⇒ entity ↦ Own ∉ RoleRights(r))
@grd8 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ ((entity ∈ dom(EntityNames) ∧ c ∈ dom(EntityNames(entity)) ∧ Parent[E] ∪ {c} = E ∪ {Root}) ∨ (E = ∅ ∧ entity = Root))
∧ (∀o · o ∈ E ∪ {entity} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
@grd9 roleRights ∈ Roles → (Entities ↔ AccessRights)
@grd10 ∀r · r ∈ Roles ∧ r ≠ oldOwner ∧ r ≠ owner ⇒ RoleRights(r) = roleRights(r)
@grd11 RoleRights(owner) ⊆ roleRights(owner)
@grd12 roleRights(oldOwner) ⊆ RoleRights(oldOwner)
@grd13 ∀r, e, ar · r ∈ Roles ∧ e ∈ Entities ⇒ (e ↦ ar ∈ roleRights(r) ∧ e ↦ ar ∉ RoleRights(r) ⇔ r = owner ∧ ar = Own)
@grd14 ∀r, e, ar · r ∈ Roles ∧ e ∈ Entities ⇒ (e ↦ ar ∉ roleRights(r) ∧ e ↦ ar ∈ RoleRights(r) ⇔ r = owner ∧ ar = Own)
@grd15 Direct(entity) = TRUE
@grd16 ∀e · e ∈ Entities ∧ e ↦ Own ∈ roleRights(owner) ∧ e ↦ Own ∉ RoleRights(owner) ⇒ (e = entity ∨ (Direct(e) = FALSE ∧ EntityMP(e) = entity))
@grd17 ∀e · e ∈ Entities ∧ (e = entity ∨ (Direct(e) = FALSE ∧ EntityMP(e) = entity)) ⇒ e ↦ Own ∈ roleRights(owner) ∧ e ↦ Own ∉ RoleRights(owner)
@grd18 ∀e · e ∈ Entities ∧ e ↦ Own ∉ roleRights(oldOwner) ∧ e ↦ Own ∈ RoleRights(oldOwner) ⇒ (e = entity ∨ (Direct(e) = FALSE ∧ EntityMP(e) = entity))
@grd19 ∀e · e ∈ Entities ∧ (e = entity ∨ (Direct(e) = FALSE ∧ EntityMP(e) = entity)) ⇒ e ↦ Own ∉ roleRights(oldOwner) ∧ e ↦ Own ∈ RoleRights(oldOwner)
then
@act1 RoleRights ≔ roleRights
end
event create_hard_link
any
subject
object
parent
name
depth
where
@grd1 object ∈ Objects
@grd2 subject ∈ Subjects
@grd3 parent ∈ Containers
@grd4 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ c∈dom(EntityNames(object)) ∧ Parent[E] ∪ {c} = E ∪ {Root}
∧ (∀o · o ∈ E ∪ {object} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
@grd5 parent ↦ WriteA ∈ SubjectAccesses(subject)
@grd6 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ parent ↦ Execute ∈ RoleRights(r)
@grd7 name ∈ Names
@grd8 ∀e · e ∈ dom(EntityNames) ⇒ parent ↦ name ∉ EntityNames(e)
@grd9 ∀e · e ∈ dom(EntityNames) ∧ parent ∈ dom(EntityNames(e)) ⇒ Direct(e) = Direct(object)
@grd10 Direct(object) = TRUE ⇒ Direct(parent) = TRUE
@grd11 Direct(object) = FALSE ∧ Direct(parent) = TRUE ⇒ EntityMP(object) = parent
@grd12 Direct(object) = FALSE ∧ Direct(parent) = TRUE ⇒ (∀e · e ∈ dom(EntityNames) ∧ parent ∈ dom(EntityNames(e)) ⇒ Direct(e) = FALSE)
@grd13 Direct(object) = FALSE ∧ Direct(parent) = FALSE ⇒ EntityMP(object) = EntityMP(parent)
@grd14 depth ∈ ℕ → ℙ(Containers)
@grd15 ∀c · c ∈ Containers ⇒ (∃i · i ∈ ℕ ∧ c ∈ depth(i))
@grd16 depth(0) = {Root}
@grd17 ∀i · i ∈ ℕ ∧ i ≠ 0 ⇒ (∀c · c ∈ depth(i) ⇒ c ≠ Root)
@grd18 ∀i · i ∈ ℕ ⇒ (∀c · c ∈ depth(i + 1) ⇒ (∃p · p ∈ depth(i) ∧ p = Parent(c)))
theorem @grd19 ∀i · i ∈ ℕ ∧ (∀c · c ∈ depth(i) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
⇒ (∀c · c ∈ depth(i + 1) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
theorem @grd20 ∀i · i ∈ ℕ ⇒ (∀c · c ∈ depth(i) ⇒ (∃E · E ⊆ Containers ∧ Root ∉ E ∧ Parent[E] ∪ {c} = E ∪ {Root}))
then
@act1 EntityNames(object) ≔ EntityNames(object) ∪ {parent ↦ name}
end
event delete_hard_link
any
subject
parent
name
object
where
@grd1 subject ∈ Subjects
@grd2 parent ∈ Containers
@grd3 object ∈ Objects
@grd4 name ∈ Names
@grd5 parent ↦ name ∈ EntityNames(object)
@grd6 ∃p, n · p ∈ Containers ∧ p ↦ n ∈ EntityNames(object) ∧ (n ≠ name ∨ p ≠ parent)
@grd7 parent ↦ WriteA ∈ SubjectAccesses(subject)
@grd8 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ parent ↦ Execute ∈ RoleRights(r)
@grd9 Shared(parent) = TRUE ⇒ (∃r · r ∈ Roles ∧ object ↦ Own ∈ RoleRights(r) ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject))
then
@act1 EntityNames(object) ≔ EntityNames(object) ∖ {parent ↦ name}
end
event rename_entity
any
subject
oldName
name
parent
entity
where
@grd1 subject ∈ Subjects
@grd2 parent ∈ Containers
@grd3 entity ∈ dom(EntityNames)
@grd4 oldName ∈ Names
@grd5 parent ↦ oldName ∈ EntityNames(entity)
@grd6 name ∈ Names
@grd7 ∀e · e ∈ dom(EntityNames) ⇒ parent ↦ name ∉ EntityNames(e)
@grd8 parent ↦ WriteA ∈ SubjectAccesses(subject)
@grd9 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ parent ↦ Execute ∈ RoleRights(r)
@grd10 Shared(parent) = TRUE ⇒ (∃r · r ∈ Roles ∧ entity ↦ Own ∈ RoleRights(r) ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject))
then
@act1 EntityNames(entity) ≔ (EntityNames(entity) ∖ {parent ↦ oldName}) ∪ {parent ↦ name}
end
event set_container_attr
any
subject
container
shared
where
@grd1 subject ∈ Subjects
@grd2 container ∈ Containers
@grd3 shared ∈ BOOL
@grd4 (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ container ↦ Own ∈ RoleRights(r))
∨ EntitiesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd5 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ ((container ∈ dom(EntityNames) ∧ c ∈ dom(EntityNames(container)) ∧ Parent[E] ∪ {c} = E ∪ {Root}) ∨ (E = ∅ ∧ container = Root))
∧ (∀o · o ∈ E ∪ {container} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
then
@act1 Shared(container) ≔ shared
end
event read_container
any
subject
container
object
where
@grd1 subject ∈ Subjects
@grd2 container ∈ Containers
@grd3 object ∈ Objects
@grd4 object ↦ WriteA ∈ SubjectAccesses(subject)
@grd5 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ container ↦ Read ∈ RoleRights(r)
@grd6 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ container ↦ Execute ∈ RoleRights(r)
@grd7 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ ((container ∈ dom(EntityNames) ∧ c ∈ dom(EntityNames(container)) ∧ Parent[E] ∪ {c} = E ∪ {Root}) ∨ (E = ∅ ∧ container = Root))
∧ (∀o · o ∈ E ∪ {container} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
end
event get_entity_attr
any
subject
entity
object
where
@grd1 subject ∈ Subjects
@grd2 entity ∈ Entities
@grd3 object ∈ Objects
@grd4 object ↦ WriteA ∈ SubjectAccesses(subject)
@grd5 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ ((entity ∈ dom(EntityNames) ∧ c ∈ dom(EntityNames(entity)) ∧ Parent[E] ∪ {c} = E ∪ {Root}) ∨ (E = ∅ ∧ entity = Root))
∧ (∀o · o ∈ E ∪ {entity} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
end
event delete_entity
any
subject
entity
parent
name
roleRights
subjectAccesses
where
@grd1 entity ∈ Entities
@grd2 entity ≠ Root
@grd3 subject ∈ Subjects
@grd4 parent ∈ Containers
@grd5 parent ↦ name ∈ EntityNames(entity)
@grd6 ∀n · n ≠ name ⇒ parent ↦ n ∉ EntityNames(entity)
@grd7 ∀e · e ∈ dom(EntityNames) ⇒ entity ∉ dom(EntityNames(e))
@grd8 ∀c · c ∈ Containers ∧ c ≠ parent ⇒ c ∉ dom(EntityNames(entity))
@grd9 parent ↦ WriteA ∈ SubjectAccesses(subject)
@grd10 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ parent ↦ Execute ∈ RoleRights(r)
@grd11 Shared(parent) = TRUE ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ entity ↦ Own ∈ RoleRights(r))
theorem @grd12 ∀e · e ∈ Entities ∧ entity ∈ Containers ⇒ EntityMP(e) ≠ entity
@grd13 roleRights ∈ Roles → (Entities ↔ AccessRights)
@grd14 ∀r · r ∈ Roles ⇒ roleRights(r) = {entity} ⩤ RoleRights(r)
@grd15 subjectAccesses ∈ Subjects → (Entities ↔ Accesses)
@grd16 ∀s · s ∈ Subjects ⇒ subjectAccesses(s) = {entity} ⩤ SubjectAccesses(s)
then
@act1 Entities ≔ Entities ∖ {entity}
@act2 Objects ≔ Objects ∖ {entity}
@act3 Containers ≔ Containers ∖ {entity}
@act4 Shared ≔ {entity} ⩤ Shared
@act5 Parent ≔ {entity} ⩤ Parent
@act6 EntityNames ≔ {entity} ⩤ EntityNames
@act7 RoleRights ≔ roleRights
@act8 SubjectAccesses ≔ subjectAccesses
@act9 Direct ≔ {entity} ⩤ Direct
@act10 CurrUnion ≔ CurrUnion ∖ {entity}
@act11 EntityMP ≔ {entity} ⩤ EntityMP
end
event create_first_subject
any
subject
newSubject
user
object
admAccesses
where
@grd1 newSubject ∈ Union ∖ CurrUnion
@grd2 subject ∈ Subjects
@grd3 user ∈ UserAccs
@grd4 object ∈ Objects
@grd5 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ object ↦ Execute ∈ RoleRights(r)
@grd6 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ c ∈ dom(EntityNames(object)) ∧ Parent[E] ∪ {c} = E ∪ {Root}
∧ (∀o · o ∈ E ∪ {object} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
@grd7 admAccesses ∈ Roles ↔ Accesses
@grd8 UserAdmRole(user) ↦ ReadA ∈ admAccesses
@grd9 UserOrdRole(user) ↦ ReadA ∈ admAccesses
@grd10 UserOrdRole(user) ↦ WriteA ∈ admAccesses
@grd11 CommonRole ↦ ReadA ∈ admAccesses
@grd12 CommonRole ↦ WriteA ∈ admAccesses
then
@act1 CurrUnion ≔ CurrUnion ∪ {newSubject}
@act2 Subjects ≔ Subjects ∪ {newSubject}
@act3 SubjectUser(newSubject) ≔ user
@act4 SubjectAccesses(newSubject) ≔ ∅
@act5 SubjectAdmAccesses(newSubject) ≔ admAccesses
@act6 SubjectOwner(newSubject) ≔ UserOrdRole(user)
@act7 SParent(newSubject) ≔ SRoot
end
event create_subject
any
subject
newSubject
user
object
admAccesses
where
@grd1 newSubject ∈ Union ∖ CurrUnion
@grd2 subject ∈ Subjects
@grd3 user ∈ UserAccs
@grd4 user = SubjectUser(subject)
@grd5 object ∈ Objects
@grd6 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ object ↦ Execute ∈ RoleRights(r)
@grd7 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ c ∈ dom(EntityNames(object)) ∧ Parent[E] ∪ {c} = E ∪ {Root}
∧ (∀o · o ∈ E ∪ {object} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
@grd8 admAccesses ∈ Roles ↔ Accesses
@grd9 UserAdmRole(user) ↦ ReadA ∈ admAccesses
@grd10 UserOrdRole(user) ↦ ReadA ∈ admAccesses
@grd11 UserOrdRole(user) ↦ WriteA ∈ admAccesses
@grd12 CommonRole ↦ ReadA ∈ admAccesses
@grd13 CommonRole ↦ WriteA ∈ admAccesses
then
@act1 CurrUnion ≔ CurrUnion ∪ {newSubject}
@act2 Subjects ≔ Subjects ∪ {newSubject}
@act3 SubjectUser(newSubject) ≔ user
@act4 SubjectAccesses(newSubject) ≔ ∅
@act5 SubjectAdmAccesses(newSubject) ≔ admAccesses
@act6 SubjectOwner(newSubject) ≔ UserOrdRole(user)
@act7 SParent(newSubject) ≔ subject
end
event set_subject_owner
any
subject
oldOwner
owner
chSubject
where
@grd1 subject ∈ Subjects
@grd2 chSubject ∈ Subjects
@grd3 oldOwner ∈ Roles
@grd4 owner ∈ Roles
@grd5 owner ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd6 SubjectsAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd7 chSubject ∈ dom(SubjectOwner) ⇒ SubjectOwner(chSubject) = oldOwner
@grd8 chSubject ∈ dom(SubjectOwner) ⇒ oldOwner ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd9 chSubject ∈ dom(SubjectOwner) ⇒ oldOwner ↦ WriteA ∈ SubjectAdmAccesses(subject)
then
@act1 SubjectOwner(chSubject) ≔ owner
end
event get_subject_attr
any
subject
chSubject
object
where
@grd1 subject ∈ Subjects
@grd2 chSubject ∈ Subjects
@grd3 object ∈ Objects
@grd4 object ↦ WriteA ∈ SubjectAccesses(subject)
end
event access_read_entity
any
subject
entity
where
@grd1 subject ∈ Subjects
@grd2 entity ∈ Entities
@grd3 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ entity ↦ Read ∈ RoleRights(r)
@grd4 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ ((entity ∈ dom(EntityNames) ∧ c ∈ dom(EntityNames(entity)) ∧ Parent[E] ∪ {c} = E ∪ {Root}) ∨ (E = ∅ ∧ entity = Root))
∧ (∀o · o ∈ E ∪ {entity} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
then
@act1 SubjectAccesses(subject) ≔ SubjectAccesses(subject) ∪ {entity ↦ ReadA}
end
event access_read_role
any
subject
role
where
@grd1 subject ∈ Subjects
@grd2 role ∈ Roles
@grd3 ∃r · r ∈ AdmRoles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ role ↦ Read ∈ RoleAdmRights(r)
then
@act1 SubjectAdmAccesses(subject) ≔ SubjectAdmAccesses(subject) ∪ {role ↦ ReadA}
end
event access_write_entity
any
subject
entity
where
@grd1 subject ∈ Subjects
@grd2 entity ∈ Entities
@grd3 ∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ entity ↦ Write∈RoleRights(r)
@grd4 ∃E, c · E ⊆ Containers ∧ Root ∉ E ∧ ((entity ∈ dom(EntityNames) ∧ c ∈ dom(EntityNames(entity)) ∧ Parent[E] ∪ {c} = E ∪ {Root}) ∨ (E = ∅ ∧ entity = Root))
∧ (∀o · o ∈ E ∪ {entity} ∪ {Root} ⇒ (∃r · r ∈ Roles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ o ↦ Execute ∈ RoleRights(r)))
then
@act1 SubjectAccesses(subject) ≔ SubjectAccesses(subject) ∪ {entity ↦ WriteA}
end
event access_write_role
any
subject
role
where
@grd1 subject ∈ Subjects
@grd2 role ∈ Roles
@grd3 ∃r · r ∈ AdmRoles ∧ r ↦ ReadA ∈ SubjectAdmAccesses(subject) ∧ role ↦ Write ∈ RoleAdmRights(r)
then
@act1 SubjectAdmAccesses(subject) ≔ SubjectAdmAccesses(subject) ∪ {role ↦ WriteA}
end
event delete_access_entity
any
subject
entity
access
where
@grd1 subject ∈ Subjects
@grd2 entity ∈ Entities
@grd3 entity ↦ access ∈ SubjectAccesses(subject)
then
@act1 SubjectAccesses(subject) ≔ SubjectAccesses(subject) ∖ {entity ↦ access}
end
event delete_access_role
any
subject
role
access
where
@grd1 subject ∈ Subjects
@grd2 role ∈ Roles
@grd3 role ↦ access ∈ SubjectAdmAccesses(subject)
then
@act1 SubjectAdmAccesses(subject) ≔ SubjectAdmAccesses(subject) ∖ {role ↦ access}
end
event delete_subject
any
subject
delSubject
where
@grd1 subject ∈ Subjects
@grd2 delSubject ∈ Subjects
@grd3 delSubject ≠ SRoot
@grd4 ∀s · s ∈ dom(SParent) ⇒ SParent(s) ≠ delSubject
@grd5 delSubject ∈ dom(SubjectOwner)
@grd6 SubjectOwner(delSubject) ↦ ReadA ∈ SubjectAdmAccesses(subject)
then
@act1 CurrUnion ≔ CurrUnion ∖ {delSubject}
@act2 Subjects ≔ Subjects ∖ {delSubject}
@act3 SubjectUser ≔ {delSubject} ⩤ SubjectUser
@act4 SubjectAccesses ≔ {delSubject} ⩤ SubjectAccesses
@act5 SubjectOwner ≔ {delSubject} ⩤ SubjectOwner
@act6 SubjectAdmAccesses ≔ {delSubject} ⩤ SubjectAdmAccesses
@act7 SParent ≔ {delSubject} ⩤ SParent
end
event create_role
any
subject
role
parent
name
admRoles
ordRoles
roleAdmRights
where
@grd1 subject ∈ Subjects
@grd2 role ∈ Union ∖ CurrUnion
@grd3 parent ∈ Roles
@grd4 ∀u · u ∈ UserAccs ⇒ parent ≠ UserAdmRole(u)
@grd5 ∀u · u ∈ UserAccs ⇒ parent ≠ UserOrdRole(u)
@grd6 parent ≠ CommonRole
@grd7 parent ∉ SpecialAdmRoles
@grd8 parent ∈ OrdRoles ⇒ RolesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd9 parent ∈ OrdRoles ⇒ RolesAR ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd10 parent ∈ AdmRoles ⇒ ARolesAR ↦ ReadA ∈ SubjectAdmAccesses(subject)
@grd11 parent ∈ AdmRoles ⇒ ARolesAR ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd12 parent ↦ WriteA ∈ SubjectAdmAccesses(subject)
@grd13 name ∈ Names
@grd14 ∀r · r ∈ Roles ⇒ name ≠ RoleName(r)
@grd15 admRoles ∈ ℙ(Union ∖ CurrUnion)
@grd16 ordRoles ∈ ℙ(Union ∖ CurrUnion)
@grd17 parent ∈ AdmRoles ⇒ ordRoles = ∅
@grd18 parent ∈ AdmRoles ⇒ admRoles = {role}
@grd19 parent ∈ OrdRoles ⇒ ordRoles = {role}
@grd20 parent ∈ OrdRoles ⇒ admRoles = ∅
@grd21 roleAdmRights ∈ AdmRoles ∪ admRoles→(Roles ∪ {role} ↔ AccessRights)
@grd22 ∀r1, ar, r2 · r1 ∈ Roles ∧ r2 ∈ AdmRoles ∧ ar ∈ AccessRights ∧ r1 ↦ ar ∈ RoleAdmRights(r2)
⇒ r1 ↦ ar ∈ roleAdmRights(r2)
@grd23 ∀r1, ar, r2 · r1 ∈ Roles ∧ r2 ∈ AdmRoles ∧ ar ∈ AccessRights ∧ r1 ↦ ar ∈ roleAdmRights(r2)
⇒ r1 ↦ ar ∈ RoleAdmRights(r2)
theorem @grd24 parent ∈ AdmRoles ⇒ role ∈ dom(roleAdmRights)
theorem @grd25 role ∈ dom(roleAdmRights) ⇒ parent ∈ AdmRoles
@grd26 parent ∈ OrdRoles ⇒ role ↦ Own ∈ roleAdmRights(RolesAR)
@grd27 parent ∈ OrdRoles ⇒ role ↦ Own ∉ roleAdmRights(ARolesAR)
@grd28 parent ∈ AdmRoles ⇒ role ↦ Own ∈ roleAdmRights(ARolesAR)
@grd29 parent ∈ AdmRoles ⇒ role ↦ Own ∉ roleAdmRights(RolesAR)
@grd30 parent ∈ AdmRoles ⇒ (∀r · r ∈ Roles ∪ {role} ⇒ r ↦ Execute ∈ roleAdmRights(role))
@grd31 parent ∈ AdmRoles ⇒ (∀ar · ar ∈ AccessRights ∧ ar ≠ Execute ⇒ ar ∉ ran(roleAdmRights(role)))
@grd32 ∀r · r ∈ AdmRoles ⇒ role ↦ Execute ∈ roleAdmRights(r)
@grd33 ∀r · r ∈ AdmRoles ∧ r ≠ RolesAR ∧ r ≠ ARolesAR ⇒ role ↦ Own ∉ roleAdmRights(r)
@grd34 ∀r · r ∈ AdmRoles ⇒ role ↦ Write ∉ roleAdmRights(r)
@grd35 ∀r · r ∈ AdmRoles ⇒ (parent ↦ Read ∈ RoleAdmRights(r) ⇔ role ↦ Read ∈ roleAdmRights(r))
then
@act1 CurrUnion ≔ CurrUnion ∪ {role}
@act2 Roles ≔ Roles ∪ {role}
@act3 AdmRoles ≔ AdmRoles ∪ admRoles
@act4 OrdRoles ≔ OrdRoles ∪ ordRoles
@act5 RoleAdmRights ≔ roleAdmRights
@act6 RParents(role) ≔ {parent}
@act7 RoleRights(role) ≔ ∅
@act8 RoleName(role) ≔ name
@act9 Shared(role) ≔ TRUE
@act10 Direct(role) ≔ TRUE
end
event create_hard_link_role
any
subject
role
parent
roleAdmRights
where
@grd1 subject ∈ Subjects
@grd2 role ∈ Roles
@grd3 ∀u · u ∈ UserAccs ⇒ role ≠ UserAdmRole(u)
@grd4 ∀u · u ∈ UserAccs ⇒ role ≠ UserOrdRole(u)
@grd5 role ≠ CommonRole
@grd6 role ∉ SpecialAdmRoles
@grd7 parent ∈ Roles
@grd8 ∀u · u ∈ UserAccs ⇒ parent ≠ UserAdmRole(u)
@grd9 ∀u · u ∈ UserAccs ⇒ parent ≠ UserOrdRole(u)
@grd10 parent ≠ CommonRole