source: examples/access_rt2_typed/query.py @ 5da2f3f

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
6cmd1:env keystore=`pwd` alpha=`creddy --keyid --cert Alpha_ID.pem` bob=`creddy --keyid --cert Bob_ID.pem` ./query.py
7cmd2: 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
11import os
12import ABAC
13
14ctxt = ABAC.Context()
15
16keystore=os.environ["keystore"]
17alpha=os.environ["alpha"]
18bob=os.environ["bob"]
19
20ctxt.load_directory(keystore)
21
22role ="[keyid:%s].role:access([string:'Read'],[urn:'file//fileA'])" % alpha
23p = "[keyid:%s]" % bob
24
25out = ctxt.query(role, p)
26print out
27
28for 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.