def render(self): login = self.parameters.get("login", self.user.login) if login != self.user.login and not self.user.has(User.PERM_USER_MANAGEMENT): raise Error.ConfutatisUserError("Permission Denied", "Access denied to other users settings", log=Log.WARNING) self.dataset["available_languages"] = localization.getLanguagesAndIdentifiers() self.dataset["user.language"] = self.env.db.getLanguage(login) or localization._DEFAULT_LANGUAGE self.dataset["ask_current_password"] = (login == self.user.login) self.dataset["can_manage_user"] = self.user.has(User.PERM_USER_MANAGEMENT) self.dataset["can_change_password"] = self.env.auth.canSetPassword() self.dataset["user.login"] = login self.dataset["user.permissions"] = [ ] if self.parameters.has_key("origin"): self.dataset["user.origin"] = self.parameters["origin"] permissions = self.env.db.getPermissions(login) for perm in User.ALL_PERMISSIONS: self.dataset["user.permissions"].append((perm, perm in permissions))
def render(self, errmsg=None): self.dataset["user.login"] = None self.dataset["user.origin"] = "user_listing" self.dataset["user.permissions"] = [] for perm in User.ALL_PERMISSIONS: self.dataset["user.permissions"] += [(perm, False)] self.dataset["errmsg"] = errmsg self.dataset["can_manage_user"] = self.user.has(User.PERM_USER_MANAGEMENT) self.dataset["can_change_password"] = self.env.auth.canSetPassword() self.dataset["ask_current_password"] = False self.dataset["available_languages"] = localization.getLanguagesAndIdentifiers() self.dataset["user.language"] = localization._DEFAULT_LANGUAGE self.dataset["hiddens"] = [ ("view", "user_add") ] self.dataset["properties"] = [ utils.text_property("Login", "login") ] if self.env.auth.canSetPassword(): self.dataset["properties"].extend((utils.password_property("Password", "password1"), utils.password_property("Password confirmation", "password2"))) for perm in User.ALL_PERMISSIONS: self.dataset["properties"].append(utils.boolean_property(perm, perm))