Chef principal prefix
authorThierry Florac <tflorac@ulthar.net>
Sat, 28 Feb 2015 15:22:56 +0100
changeset 4 ec4cd04d4a8c
parent 3 1dca3f8a61e6
child 5 181b8ff133b7
Chef principal prefix
src/pyams_security/plugin/admin.py
--- a/src/pyams_security/plugin/admin.py	Sat Feb 28 15:22:21 2015 +0100
+++ b/src/pyams_security/plugin/admin.py	Sat Feb 28 15:22:56 2015 +0100
@@ -12,6 +12,7 @@
 
 __docformat__ = 'restructuredtext'
 
+
 # import standard library
 
 # import interfaces
@@ -63,6 +64,8 @@
     def get_principal(self, principal_id):
         if not self.enabled:
             return None
+        if not principal_id.startswith(self.prefix + ':'):
+            return None
         prefix, login = principal_id.split(':', 1)
         if (prefix == self.prefix) and (login == self.login):
             return PrincipalInfo(id=principal_id,