250 | | if self.form.has_key("action") : |
251 | | action = self.form["action"].value |
252 | | if action == _("Report") : |
253 | | if self.form.has_key("printers") : |
254 | | printersfield = self.form["printers"] |
255 | | if type(printersfield) != type([]) : |
256 | | printersfield = [ printersfield ] |
257 | | printers = [self.storage.getPrinter(p.value) for p in printersfield] |
| 254 | if self.form.has_key("report") : |
| 255 | if self.form.has_key("printers") : |
| 256 | printersfield = self.form["printers"] |
| 257 | if type(printersfield) != type([]) : |
| 258 | printersfield = [ printersfield ] |
| 259 | printers = [self.storage.getPrinter(p.value) for p in printersfield] |
| 260 | else : |
| 261 | printers = self.storage.getMatchingPrinters("*") |
| 262 | remuser = os.environ.get("REMOTE_USER", "root") |
| 263 | |
| 264 | # special hack to accomodate mod_auth_ldap Apache module |
| 265 | try : |
| 266 | remuser = remuser.split("=")[1].split(",")[0] |
| 267 | except IndexError : |
| 268 | pass |
| 269 | |
| 270 | if remuser == "root" : |
| 271 | if self.form.has_key("ugmask") : |
| 272 | ugmask = self.form["ugmask"].value |
| 273 | else : |
| 274 | ugmask = "*" |
| 275 | else : |
| 276 | if self.form.has_key("isgroup") : |
| 277 | user = self.storage.getUser(remuser) |
| 278 | if user.Exists : |
| 279 | ugmask = " ".join([ g.Name for g in self.storage.getUserGroups(user) ]) |
| 280 | else : |
| 281 | ugmask = remuser # result will probably be empty, we don't care |
259 | | printers = self.storage.getMatchingPrinters("*") |
260 | | remuser = os.environ.get("REMOTE_USER", "root") |
261 | | |
262 | | # special hack to accomodate mod_auth_ldap Apache module |
263 | | try : |
264 | | remuser = remuser.split("=")[1].split(",")[0] |
265 | | except IndexError : |
266 | | pass |
267 | | |
268 | | if remuser == "root" : |
269 | | if self.form.has_key("ugmask") : |
270 | | ugmask = self.form["ugmask"].value |
271 | | else : |
272 | | ugmask = "*" |
273 | | else : |
274 | | if self.form.has_key("isgroup") : |
275 | | user = self.storage.getUser(remuser) |
276 | | if user.Exists : |
277 | | ugmask = " ".join([ g.Name for g in self.storage.getUserGroups(user) ]) |
278 | | else : |
279 | | ugmask = remuser # result will probably be empty, we don't care |
280 | | else : |
281 | | ugmask = remuser |
282 | | if self.form.has_key("isgroup") : |
283 | | isgroup = 1 |
284 | | else : |
285 | | isgroup = 0 |
286 | | else : |
287 | | self.error("Invalid action [%s]" % action) |
| 283 | ugmask = remuser |
| 284 | if self.form.has_key("isgroup") : |
| 285 | isgroup = 1 |
| 286 | else : |
| 287 | isgroup = 0 |