]> git.ipfire.org Git - ipfire.org.git/commitdiff
accounts: Use c attribute to store the country
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 14 Dec 2023 11:47:35 +0000 (11:47 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 14 Dec 2023 11:56:23 +0000 (11:56 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/backend/accounts.py

index 7d89e6729817970b2384b6446f23f6da0a83a038..44c01306ad3bc89a3b7af2d18499f085e6ba7faa 100644 (file)
@@ -604,7 +604,7 @@ class Accounts(Object):
                ret = {}
 
                for country in iso3166.countries:
-                       count = self._count("(&(objectClass=person)(st=%s))" % country.alpha2)
+                       count = self._count("(&(objectClass=person)(c=%s))" % country.alpha2)
 
                        if count:
                                ret[country] = count
@@ -904,12 +904,19 @@ class Account(LDAPObject):
 
        postal_code = property(get_postal_code, set_postal_code)
 
-       # XXX This should be c
-       def get_country_code(self):
+       def get_state(self):
                return self._get_string("st")
 
+       def set_state(self, state):
+               self._set_string("st", state)
+
+       state = property(get_state, set_state)
+
+       def get_country_code(self):
+               return self._get_string("c")
+
        def set_country_code(self, country_code):
-               self._set_string("st", country_code)
+               self._set_string("c", country_code)
 
        country_code = property(get_country_code, set_country_code)