def getAllPolicyInfo(self,req): environ = req.environ self.db_session=environ['db_session'] context=environ['hydrogen.context'] action="getallpolicyinfo" target=SvTarget.factory().to_dict() policy.init() try: policy.enforce(context, action, target) except Exception,e: return e.msg
def create(self,req,body=None): environ = req.environ user_id = environ['HTTP_X_USER_ID'] user_name = environ['HTTP_X_USER_NAME'] self.db_session=environ['db_session'] # need to upgrade to use permission engine #验证权限 context=environ['hydrogen.context'] action="deploy_service" target=SvTarget.factory().to_dict() policy.init() try: policy.enforce(context, action, target) except Exception,e: return e.msg
user_id = environ['HTTP_X_USER_ID'] user_name = environ['HTTP_X_USER_NAME'] user_role = environ['HTTP_X_ROLES'] ''' self.db_session=environ['db_session'] context=environ['hydrogen.context'] action="undeploy_service" try: target=SvTarget.svtarget_factory(self.db_session,id).to_dict() except Exception,e: return e.msg policy.init() try: policy.enforce(context, action, target) except Exception,e: return e.msg print self.rmsvMan.deleteSvOnVM(self.db_session,id); #删除本地sv_arg_type_tb上的数据 db.deleteSvInfoOnTB(self.db_session,id) #删除本地sv_tb上的数据 db.deleteSvArg4IDOnTB(self.db_session,id) return 'delete successfully!' def update(self,req,body,id=None): environ = req.environ ''' user_id = environ['HTTP_X_USER_ID']