2015-04-15 21:13:14 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim:set expandtab tabstop=4 shiftwidth=4:
|
|
|
|
#
|
|
|
|
# The MIT License (MIT)
|
|
|
|
# LdapCherry
|
|
|
|
# Copyright (c) 2014 Carpentier Pierre-Francois
|
|
|
|
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
2015-05-12 01:24:16 +02:00
|
|
|
from ldapcherry.pyyamlwrapper import loadNoDump
|
|
|
|
|
2015-04-15 21:13:14 +02:00
|
|
|
|
|
|
|
class Roles:
|
|
|
|
|
|
|
|
def __init__(self, role_file):
|
2015-05-12 01:24:16 +02:00
|
|
|
stream = open(role_file, 'r')
|
|
|
|
self.roles_raw = loadNoDump(stream)
|
|
|
|
stream.close()
|
|
|
|
self._nest()
|
2015-04-15 21:13:14 +02:00
|
|
|
|
2015-05-12 01:24:16 +02:00
|
|
|
def _nest(self):
|
2015-04-15 21:13:14 +02:00
|
|
|
"""nests the roles (creates roles hierarchy)"""
|
2015-05-12 01:24:16 +02:00
|
|
|
self.roles = self.roles_raw
|
2015-04-15 21:13:14 +02:00
|
|
|
|
|
|
|
def write(self, out_file):
|
|
|
|
"""write the nested role hierarchy to a file"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def get_roles(self, groups):
|
|
|
|
"""get list of roles and list of standalone groups"""
|
|
|
|
pass
|
|
|
|
|
|
|
|
def get_groups(self, roles):
|
|
|
|
"""get the list of groups from roles"""
|
|
|
|
pass
|