Show More
@@ -64,12 +64,7 b' class PermissionsController(BaseControll' | |||
|
64 | 64 | c.active = 'application' |
|
65 | 65 | self.__load_data() |
|
66 | 66 | |
|
67 | c.user = User.get_default_user() | |
|
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) | |
|
67 | c.user = User.get_default_user(refresh=True) | |
|
73 | 68 | |
|
74 | 69 | app_settings = SettingsModel().get_all_settings() |
|
75 | 70 | defaults = { |
@@ -874,10 +874,16 b' class User(Base, BaseModel):' | |||
|
874 | 874 | .order_by(User.username.asc()).all() |
|
875 | 875 | |
|
876 | 876 | @classmethod |
|
877 | def get_default_user(cls, cache=False): | |
|
877 | def get_default_user(cls, cache=False, refresh=False): | |
|
878 | 878 | user = User.get_by_username(User.DEFAULT_USER, cache=cache) |
|
879 | 879 | if user is None: |
|
880 | 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 | 887 | return user |
|
882 | 888 | |
|
883 | 889 | def _get_default_perms(self, user, suffix=''): |
General Comments 0
You need to be logged in to leave comments.
Login now