2016-03-07 17:13:03 +02:00
|
|
|
#!/usr/bin/python3
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
2016-03-16 17:26:25 +02:00
|
|
|
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
|
|
|
|
from base.model.Profile import Profile
|
2016-03-07 17:13:03 +02:00
|
|
|
import json
|
|
|
|
|
|
|
|
class Policy(object):
|
|
|
|
"""docstring for Policy"""
|
|
|
|
def __init__(self,message):
|
2016-03-16 17:26:25 +02:00
|
|
|
self.policy = message
|
|
|
|
|
|
|
|
@property
|
|
|
|
def ahenk_policy_version(self):
|
|
|
|
return self.policy['ahenkpolicyversion']
|
|
|
|
|
|
|
|
@property
|
|
|
|
def ahenk_profiles(self):
|
|
|
|
profiles=[]
|
|
|
|
for p in self.policy['ahenkprofiles']:
|
|
|
|
profiles.append(Profile(p))
|
|
|
|
return profiles
|
|
|
|
|
|
|
|
@property
|
|
|
|
def user_policy_version(self):
|
|
|
|
return self.policy['userpolicyversion']
|
|
|
|
|
2016-03-18 18:20:14 +02:00
|
|
|
@property
|
|
|
|
def timestamp(self):
|
|
|
|
self.request['timestamp']
|
|
|
|
|
2016-03-16 17:26:25 +02:00
|
|
|
@property
|
|
|
|
def user_profiles(self):
|
|
|
|
profiles=[]
|
|
|
|
for p in self.policy['userprofiles']:
|
|
|
|
profiles.append(Profile(p))
|
|
|
|
return profiles
|