mei_rt2mei_rt2_fix_1meiyap-rt1rt2
Last change
on this file since 9502c50 was
9502c50,
checked in by Mei <mei@…>, 12 years ago
|
1) rename examples' rr to run_query
2) updated some doc
3) add decode to creddy --roles and creddy --display --show so it will
show more useful attribute rule string
4) stub in the python script in one of the example directory
|
-
Property mode set to
100755
|
File size:
605 bytes
|
Rev | Line | |
---|
[9502c50] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | """ |
---|
| 4 | to test with python |
---|
| 5 | |
---|
| 6 | env PYTHON_PATH=/usr/local/lib/python2.7/site-packages ABAC_CN=1 keystore=`pwd` alpha=`creddy --keyid --cert Alpha_ID.pem` bob=`creddy --keyid --cert Bob_ID.pem` ./query.py |
---|
| 7 | |
---|
| 8 | """ |
---|
| 9 | |
---|
| 10 | import os |
---|
| 11 | import ABAC |
---|
| 12 | |
---|
| 13 | ctxt = ABAC.Context() |
---|
| 14 | |
---|
| 15 | keystore=os.environ["keystore"] |
---|
| 16 | alpha=os.environ["alpha"] |
---|
| 17 | bob=os.environ["bob"] |
---|
| 18 | |
---|
| 19 | ctxt.load_directory(keystore) |
---|
| 20 | |
---|
| 21 | role ="[keyid:%s].role:access([string:'Read'],[urn:'file//fileA'])" % alpha |
---|
| 22 | p = "[keyid:%s]" % bob |
---|
| 23 | |
---|
| 24 | out = ctxt.query(role, p) |
---|
| 25 | print out |
---|
| 26 | |
---|
| 27 | for c in out[1]: |
---|
| 28 | print "%s <- %s" % (c.head().string(), c.tail().string()) |
---|
| 29 | |
---|
| 30 | |
---|
Note: See
TracBrowser
for help on using the repository browser.