mei_rt2mei_rt2_fix_1meiyap-rt1rt2
Last change
on this file since 5da2f3f was
302f477,
checked in by Mei <mei@…>, 13 years ago
|
1) insert a ABAC query using python into examples directory
(added to be part of runcheck)
2) tweak doc alittle bit more
|
-
Property mode set to
100755
|
File size:
677 bytes
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | """ |
---|
4 | to test with python |
---|
5 | |
---|
6 | cmd1:env keystore=`pwd` alpha=`creddy --keyid --cert Alpha_ID.pem` bob=`creddy --keyid --cert Bob_ID.pem` ./query.py |
---|
7 | cmd2: env ABAC_CN=1 keystore=`pwd` alpha=`creddy --keyid --cert Alpha_ID.pem` bob=`creddy --keyid --cert Bob_ID.pem` ./query.py |
---|
8 | |
---|
9 | """ |
---|
10 | |
---|
11 | import os |
---|
12 | import ABAC |
---|
13 | |
---|
14 | ctxt = ABAC.Context() |
---|
15 | |
---|
16 | keystore=os.environ["keystore"] |
---|
17 | alpha=os.environ["alpha"] |
---|
18 | bob=os.environ["bob"] |
---|
19 | |
---|
20 | ctxt.load_directory(keystore) |
---|
21 | |
---|
22 | role ="[keyid:%s].role:access([string:'Read'],[urn:'file//fileA'])" % alpha |
---|
23 | p = "[keyid:%s]" % bob |
---|
24 | |
---|
25 | out = ctxt.query(role, p) |
---|
26 | print out |
---|
27 | |
---|
28 | for c in out[1]: |
---|
29 | print "%s <- %s" % (c.head().string(), c.tail().string()) |
---|
30 | |
---|
31 | |
---|
Note: See
TracBrowser
for help on using the repository browser.