[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/se3-logonpy/usr/share/se3/logonpy/ -> se3Profile.py (source)

   1  # -*- coding: utf-8 -*-
   2  import sys, os
   3  
   4  class se3Profile:
   5  
   6      def __init__ (self, user):
   7          """
   8              Init Profile
   9          """
  10          self.__user = user
  11  
  12  
  13      def __del__ (self):
  14          """
  15              Del Profile
  16          """
  17   
  18      def lock (self):
  19          """
  20              Lock user profile
  21          """
  22          try:
  23              if os.access ("/home/profiles/%s/ntuser.dat" % self.__user, os.F_OK):
  24                  self.__chmod ("/home/profiles/%s" % self.__user, 0500)
  25                  os.rename ("/home/profiles/%s/ntuser.dat" % self.__user, \
  26                             "/home/profiles/%s/ntuser.man" % self.__user)
  27                                
  28          except OSError:
  29              print "Can't lock profile"
  30      
  31  
  32      def unlock (self):
  33          """
  34              Unlock user profile
  35          """
  36          try:
  37              if os.access ("/home/profiles/%s/ntuser.man" % self.__user, os.F_OK):
  38                  self.__chmod("/home/profiles/%s" % self.__user, 0700)
  39                  os.rename ("/home/profiles/%s/ntuser.man" % self.__user, \
  40                             "/home/profiles/%s/ntuser.dat" % self.__user)
  41                                
  42          except OSError:
  43              print "Can't unlock profile"
  44      
  45  
  46      def __chmod (self, dirPath, mode):
  47          """
  48              Recursive dir chmod
  49          """
  50          os.chmod (dirPath, mode)
  51          for root, dirs, files in os.walk (dirPath, False):
  52              for name in files:
  53                  os.chmod (os.path.join (root, name), mode)
  54              for name in dirs:
  55                  os.chmod (os.path.join (root, name), mode)
  56  


Generated: Tue Mar 17 22:47:18 2015 Cross-referenced by PHPXref 0.7.1