Ejemplo n.º 1
0
Archivo: test2.py Proyecto: Jorbac/v0
from interpretor import interpretor
from configurer import configurer
from evaluator import evaluator
from admin import admin
from time import time

itp = interpretor("localhost", 27017)
config = configurer(itp)
eva = evaluator(itp)
admin = admin(eva, config)


"""This script performs a complete test of our Python+MongoDB OrBAC single Tenant implementation"""

"""Test Scenario
1. we start from zero having a tenant called "apple"
2. we insert all administrative views including: subject,action,object,role,activity,view,role_assignment,activity_assignment,licence
3. we initialize it with assigning "John" to subject, "admin" to role, insert delete to action, insertActivity, deleteActivity and manage to activity and the first licence " John is permitted to manage licence in apple, also "nominal" to context
4. we then use John to create licences for himself for all administrative views, then use John to create different users,actions, resources and assign them to different abstract roles,activities,views
5. use John to assign users privileges
6. use John to assign admin privileges to someone
"""
"""1. we start from zero having a tenant called apple"""
# create tenant
config.CreateTenant("null", "apple")
"""2. we insert all administrative views including: subject,action,object,role,activity,view,role_assignment,activity_assignment,licence
"""
# create administrative views
config.AssignView("null", "apple", {"_id": "subject", "attr": {}})
config.AssignView("null", "apple", {"_id": "action", "attr": {}})
config.AssignView("null", "apple", {"_id": "object", "attr": {}})
Ejemplo n.º 2
0
from interpretor import interpretor
from configurer import configurer
from evaluator import evaluator
from admin import admin

itp=interpretor('localhost',27017)
config=configurer(itp)
eva=evaluator(itp)
ad=admin(eva,config)




"""This script performs a complete test of our Python+MongoDB OrBAC single Tenant implementation"""

"""Test Scenario
1. we start from zero having a tenant called "apple"
2. we insert all administrative views including: srole,activity,view,role_assignment,activity_assignment,licence,cross_licence
3. we initialize it with assigning "John" to subject, "admin" to role, insert delete to action, insertActivity, deleteActivity and manage to activity and the first licence " John is permitted to manage licence in apple, also "nominal" to context
4. we then use John to create licences for himself for all administrative views, then use John to create different users,actions, resources and assign them to different abstract roles,activities,views
5. use John to assign users privileges
6. use John to assign admin privileges to someone
"""
"""1. we start from zero having a tenant called apple"""
#create tenant
config.CreateTenant('null','apple')
"""2. we insert all administrative views including: subject,action,object,role,activity,view,role_assignment,activity_assignment,licence
"""
#create administrative views
config.AssignView('null','apple',{'_id':'context','attr':{}})
config.AssignView('null','apple',{'_id':'role','attr':{}})
Ejemplo n.º 3
0
Archivo: server.py Proyecto: Jorbac/v0
import web
import ast
import sys
sys.path.append('/home/qian/Desktop/Jorbac')

from evaluator import evaluator
from interpretor import interpretor



itp=interpretor('127.0.0.1',27017)
eva=evaluator(itp)
urls={

	'/.*','index'
	
}



class index:
	def GET(self):
		return "Hello, world!"
	def POST(self):
		i=web.input()
		result= eva.concrete_evaluate(i.t,i.s,i.a,i.o)
		return str(result)



application = web.application(urls,globals()).wsgifunc()