From 4b8dcb233fb4fc5132b18084034ccc4a093703c6 Mon Sep 17 00:00:00 2001 From: Ralf Ertzinger Date: Fri, 21 Feb 2014 15:08:22 +0100 Subject: [PATCH] Move RBAC functionality into linux specific module and use it --- .../time-slider/lib/time_slider/linux/rbac.py | 58 ++++++++++++++++++++++ .../time-slider/lib/time_slider/timesliderd.py | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100755 usr/share/time-slider/lib/time_slider/linux/rbac.py diff --git a/usr/share/time-slider/lib/time_slider/linux/rbac.py b/usr/share/time-slider/lib/time_slider/linux/rbac.py new file mode 100755 index 0000000..64c7428 --- /dev/null +++ b/usr/share/time-slider/lib/time_slider/linux/rbac.py @@ -0,0 +1,58 @@ +#!/usr/bin/python2 +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +import time_slider.rbac as base + +class RBACprofile(base.RBACprofile): + + def __init__(self, name = None): + base.RBACprofile.__init__(self, name) + + def get_profiles(self): + # No real profile support yet + return [] + + def get_auths(self): + # No real auths support yet + return [] + + def has_profile(self, profile): + # root is all powerful + if self.uid == 0: + return True + else: + return False + + def has_auth(self, auth): + # root is all powerful + if self.uid == 0: + return True + else: + return False + +if __name__ == "__main__": + rbac = RBACprofile() + print rbac.name + print rbac.uid + print rbac.profiles + print rbac.auths + diff --git a/usr/share/time-slider/lib/time_slider/timesliderd.py b/usr/share/time-slider/lib/time_slider/timesliderd.py index 194d8b1..2261ee9 100755 --- a/usr/share/time-slider/lib/time_slider/timesliderd.py +++ b/usr/share/time-slider/lib/time_slider/timesliderd.py @@ -46,7 +46,7 @@ import smf import timeslidersmf import autosnapsmf import plugin -from linuxrbac import RBACprofile +from time_slider.linux.rbac import RBACprofile import util _MINUTE = 60 -- 1.8.3.1