| 222 | |
| 223 | def sanitizeNames(self, options, names) : |
| 224 | """Ensures that an user can only see the datas he is allowed to see, by modifying the list of names.""" |
| 225 | if not self.config.isAdmin : |
| 226 | username = pwd.getpwuid(os.geteuid())[0] |
| 227 | if not options["list"] : |
| 228 | raise PyKotaCommandLineError, "%s : %s" % (username, _("You're not allowed to use this command.")) |
| 229 | else : |
| 230 | if options["groups"] : |
| 231 | user = self.storage.getUser(username) |
| 232 | if user.Exists : |
| 233 | return [ g.Name for g in self.storage.getUserGroups(user) ] |
| 234 | return [ username ] |
| 235 | elif not names : |
| 236 | return ["*"] |
| 237 | else : |
| 238 | return names |