From 7945c0daad7d2e3b8380c18b7d080e54e0a948ed Mon Sep 17 00:00:00 2001 From: Thibaut Horel Date: Fri, 30 Jul 2010 09:29:24 +0200 Subject: Project creation. --- permission.py | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 permission.py (limited to 'permission.py') diff --git a/permission.py b/permission.py new file mode 100644 index 0000000..310cef2 --- /dev/null +++ b/permission.py @@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +#TODO : move the globals to a config file (use the config file parser module) +PERM_LIST=['READ','MODIFY','APPEND'] #just add a string here to define a new permission +PERMS = len(PERM_LIST) +MAX = (1< MAX) or (init < 0) : + raise PermissionError('Permission int not in correct range') + result = [] + for shift in range(PERMS-1,-1,-1) : + if init>>shift : + result.append(PERM_LIST[shift]) + init = init-(1<