Show
Ignore:
Timestamp:
10/05/08 19:04:08 (16 years ago)
Author:
jerome
Message:

edpykota now supports new style command line handling.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • pykota/trunk/pykota/tool.py

    r3430 r3432  
    187187            return False 
    188188 
    189     def sanitizeNames(self, options, names) : 
    190         """Ensures that an user can only see the datas he is allowed to see, by modifying the list of names.""" 
     189    def sanitizeNames(self, names, isgroups) : 
     190        """Sanitize users and groups names if needed.""" 
    191191        if not self.config.isAdmin : 
    192192            username = pwd.getpwuid(os.geteuid())[0] 
    193             if not options["list"] : 
    194                 raise PyKotaCommandLineError, "%s : %s" % (username, _("You're not allowed to use this command.")) 
    195             else : 
    196                 if options["groups"] : 
    197                     user = self.storage.getUser(username) 
    198                     if user.Exists : 
    199                         return [ g.Name for g in self.storage.getUserGroups(user) ] 
    200                 return [ username ] 
    201         elif not names : 
    202             return ["*"] 
    203         else : 
    204             return names 
     193            if isgroups : 
     194                user = self.storage.getUser(username) 
     195                if user.Exists : 
     196                    return [ g.Name for g in self.storage.getUserGroups(user) ] 
     197            return [ username ] 
     198        return names 
    205199 
    206200    def display_version_and_quit(self) :