1034 | | def writeUserOverCharge(self, user, factor) : |
1035 | | """Sets the user's overcharging coefficient.""" |
1036 | | fields = { |
1037 | | "pykotaOverCharge" : str(factor), |
1038 | | } |
1039 | | self.doModify(user.ident, fields) |
1040 | | |
1041 | | def writeUserLimitBy(self, user, limitby) : |
1042 | | """Sets the user's limiting factor.""" |
1043 | | fields = { |
1044 | | "pykotaLimitBy" : limitby, |
1045 | | } |
1046 | | self.doModify(user.ident, fields) |
1047 | | |
1048 | | def writeGroupLimitBy(self, group, limitby) : |
1049 | | """Sets the group's limiting factor.""" |
1050 | | fields = { |
1051 | | "pykotaLimitBy" : limitby, |
1052 | | } |
1053 | | self.doModify(group.ident, fields) |
| 1038 | def saveUser(self, user) : |
| 1039 | """Saves the user to the database in a single operation.""" |
| 1040 | newfields = { |
| 1041 | "pykotaLimitBy" : (user.LimitBy or "quota"), |
| 1042 | "pykotaOverCharge" : str(user.OverCharge), |
| 1043 | } |
| 1044 | if user.Email : |
| 1045 | newfields.update({self.info["usermail"]: user.Email}) |
| 1046 | if user.Description is not None : |
| 1047 | newfields.update({"description": self.userCharsetToDatabase(user.Description)}) |
| 1048 | self.doModify(user.ident, newfields) |
| 1049 | |
| 1050 | def saveGroup(self, group) : |
| 1051 | """Saves the group to the database in a single operation.""" |
| 1052 | newfields = { |
| 1053 | "pykotaLimitBy" : (group.LimitBy or "quota"), |
| 1054 | } |
| 1055 | if group.Description is not None : |
| 1056 | newfields.update({"description": self.userCharsetToDatabase(group.Description)}) |
| 1057 | self.doModify(group.ident, newfields) |