Show More
@@ -64,12 +64,7 b' class PermissionsController(BaseControll' | |||||
64 | c.active = 'application' |
|
64 | c.active = 'application' | |
65 | self.__load_data() |
|
65 | self.__load_data() | |
66 |
|
66 | |||
67 | c.user = User.get_default_user() |
|
67 | c.user = User.get_default_user(refresh=True) | |
68 |
|
||||
69 | # TODO: johbo: The default user might be based on outdated state which |
|
|||
70 | # has been loaded from the cache. A call to refresh() ensures that the |
|
|||
71 | # latest state from the database is used. |
|
|||
72 | Session().refresh(c.user) |
|
|||
73 |
|
68 | |||
74 | app_settings = SettingsModel().get_all_settings() |
|
69 | app_settings = SettingsModel().get_all_settings() | |
75 | defaults = { |
|
70 | defaults = { |
@@ -874,10 +874,16 b' class User(Base, BaseModel):' | |||||
874 | .order_by(User.username.asc()).all() |
|
874 | .order_by(User.username.asc()).all() | |
875 |
|
875 | |||
876 | @classmethod |
|
876 | @classmethod | |
877 | def get_default_user(cls, cache=False): |
|
877 | def get_default_user(cls, cache=False, refresh=False): | |
878 | user = User.get_by_username(User.DEFAULT_USER, cache=cache) |
|
878 | user = User.get_by_username(User.DEFAULT_USER, cache=cache) | |
879 | if user is None: |
|
879 | if user is None: | |
880 | raise Exception('FATAL: Missing default account!') |
|
880 | raise Exception('FATAL: Missing default account!') | |
|
881 | if refresh: | |||
|
882 | # The default user might be based on outdated state which | |||
|
883 | # has been loaded from the cache. | |||
|
884 | # A call to refresh() ensures that the | |||
|
885 | # latest state from the database is used. | |||
|
886 | Session().refresh(user) | |||
881 | return user |
|
887 | return user | |
882 |
|
888 | |||
883 | def _get_default_perms(self, user, suffix=''): |
|
889 | def _get_default_perms(self, user, suffix=''): |
General Comments 0
You need to be logged in to leave comments.
Login now