Home | Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 # -*- coding: utf-8 -*- 3 # 4 # Copyright © 2010 Red Hat, Inc. 5 # 6 # This software is licensed to you under the GNU General Public License, 7 # version 2 (GPLv2). There is NO WARRANTY for this software, express or 8 # implied, including the implied warranties of MERCHANTABILITY or FITNESS 9 # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 10 # along with this software; if not, see 11 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 12 # 13 # Red Hat trademarks are not licensed under GPLv2. No permission is 14 # granted to use or replicate Red Hat trademarks that are incorporated 15 # in this software or its documentation. 16 17 import threading 18 19 from pulp.server.util import Singleton 20 21 # default system principal ---------------------------------------------------- 22 31 32 # thread-local storage for holding the current principal ---------------------- 33 34 _storage = threading.local() 35 36 # principal api --------------------------------------------------------------- 3739 """ 40 Set the current principal (user) of the system. 41 @param principal: current system user 42 """ 43 _storage.principal = principal44 4547 """ 48 Get the current principal (user) of the system. 49 50 @return: current principal 51 @rtype: pulp.server.db.model.User instance if one was specified in set_principal; 52 pulp.server.auth.auth.SystemPrincipal otherwise 53 """ 54 if not hasattr(_storage, 'principal'): 55 _storage.principal = SystemPrincipal() 56 return _storage.principal57 5860 """ 61 Clear the current principal (user) of the system. 62 This resets the principal to a "system" default. 63 """ 64 _storage.principal = SystemPrincipal()65
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Sep 7 12:30:37 2010 | http://epydoc.sourceforge.net |