mirror of
https://github.com/Pardus-LiderAhenk/ahenk
synced 2024-11-25 22:52:24 +03:00
created policy structure
This commit is contained in:
parent
fb16ab2e4f
commit
656c6aab36
3 changed files with 76 additions and 1 deletions
25
opt/ahenk/base/model/Plugin.py
Normal file
25
opt/ahenk/base/model/Plugin.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
|
||||||
|
import json
|
||||||
|
|
||||||
|
class Plugin(object):
|
||||||
|
"""docstring for Plugin"""
|
||||||
|
def __init__(self,message):
|
||||||
|
self.plugin = message
|
||||||
|
|
||||||
|
@property
|
||||||
|
def id(self):
|
||||||
|
return self.plugin['id']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def name(self):
|
||||||
|
return self.plugin['name']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def version(self):
|
||||||
|
return self.plugin['version']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def description(self):
|
||||||
|
return self.plugin['description']
|
|
@ -1,9 +1,33 @@
|
||||||
#!/usr/bin/python3
|
#!/usr/bin/python3
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
# Author: İsmail BAŞARAN <ismail.basaran@tubitak.gov.tr> <basaran.ismaill@gmail.com>
|
||||||
|
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
|
||||||
|
from base.model.Profile import Profile
|
||||||
import json
|
import json
|
||||||
|
|
||||||
class Policy(object):
|
class Policy(object):
|
||||||
"""docstring for Policy"""
|
"""docstring for Policy"""
|
||||||
def __init__(self,message):
|
def __init__(self,message):
|
||||||
self.message = message
|
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']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def user_profiles(self):
|
||||||
|
profiles=[]
|
||||||
|
for p in self.policy['userprofiles']:
|
||||||
|
profiles.append(Profile(p))
|
||||||
|
return profiles
|
||||||
|
|
26
opt/ahenk/base/model/Profile.py
Normal file
26
opt/ahenk/base/model/Profile.py
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Author: Volkan Şahin <volkansah.in> <bm.volkansahin@gmail.com>
|
||||||
|
from base.model.Plugin import Plugin
|
||||||
|
import json
|
||||||
|
|
||||||
|
class Profile(object):
|
||||||
|
"""docstring for Profile"""
|
||||||
|
def __init__(self,message):
|
||||||
|
self.profile = message
|
||||||
|
|
||||||
|
@property
|
||||||
|
def id(self):
|
||||||
|
return self.profile['id']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def params(self):
|
||||||
|
return self.profile['params']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def date(self):
|
||||||
|
return self.profile['date']
|
||||||
|
|
||||||
|
@property
|
||||||
|
def plugin(self):
|
||||||
|
return Plugin(self.profile['plugin'])
|
Loading…
Reference in a new issue