Skip to content

Commit

Permalink
Feat: add auth context for React view
Browse files Browse the repository at this point in the history
  • Loading branch information
thomlamb committed Aug 14, 2024
1 parent 00202ff commit 7f9e2c9
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/imio/smartweb/core/contents/rest/directory/view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
orientation view/orientation;
current-language view/current_language;
display-map view/display_map;
view-path view/view_path;"></smartweb-annuaire>
view-path view/view_path;
context-authenticated-user view/context_authenticated_user;"></smartweb-annuaire>
</div>
</metal:main>
</body>
Expand Down
3 changes: 2 additions & 1 deletion src/imio/smartweb/core/contents/rest/events/view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
only-past-events view/only_past_events;
view-path view/view_path;
display_agendas_titles view/display_agendas_titles;
show-categories-or-topics view/show_categories_or_topics;"></smartweb-events>
show-categories-or-topics view/show_categories_or_topics;
context-authenticated-user view/context_authenticated_user;"></smartweb-events>
</div>
</metal:main>
</body>
Expand Down
3 changes: 2 additions & 1 deletion src/imio/smartweb/core/contents/rest/news/view.pt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
current-language view/current_language;
view-path view/view_path;
display_newsfolders_titles view/display_newsfolders_titles;
show-categories-or-topics view/show_categories_or_topics;"></smartweb-news>
show-categories-or-topics view/show_categories_or_topics;
context-authenticated-user view/context_authenticated_user;"></smartweb-news>
</div>
</metal:main>
</body>
Expand Down
4 changes: 4 additions & 0 deletions src/imio/smartweb/core/contents/rest/view.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def orientation(self):
def current_language(self):
return api.portal.get_current_language()[:2]

@property
def context_authenticated_user(self):
return api.user.is_anonymous()

@property
def view_path(self):
url = self.context.absolute_url()
Expand Down

0 comments on commit 7f9e2c9

Please sign in to comment.