Skip to content

Commit fb94fb3

Browse files
Prosunjit BiswasProsunjit Biswas
Prosunjit Biswas
authored and
Prosunjit Biswas
committed
a simple test case added
1 parent 71b3cc0 commit fb94fb3

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

test.py

+21-1
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,25 @@ def complext_test():
2424
print lbac.acl
2525
print lbac.request(user="u1",object="o6",action="read")
2626

27+
28+
def simple_test_case():
29+
conf = Configuration()
30+
31+
user_hierarchy = [ ("manager",["employee"]), ("employee",["stuff"]) ]
32+
33+
object_hierarchy = [ ("secret", ["public"]), ("confidential",["public"]) ]
34+
35+
conf.object_label_hierarchy = object_hierarchy
36+
37+
conf.user_label_hierarchy = user_hierarchy
38+
39+
conf.add_policy("read",[ ("confidential","employee" ) ] )
40+
# create LaBAC class with this configuration
41+
lbac = LBAC(conf)
42+
# now check if 'employee' can read 'confidential'
43+
print lbac.request(user='employee', object='confidential', action='read')
44+
45+
2746
if __name__ == "__main__":
28-
complext_test()
47+
#complext_test()
48+
simple_test_case()

0 commit comments

Comments
 (0)