Skip to content

Commit

Permalink
role is a reserved keyword in sql
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa committed Sep 15, 2024
1 parent be043dd commit dd3d9a2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/official-site/examples/authentication/index.sql
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
-- redirect the user to the login page if they are not logged in
-- this query should be present at the top of every page that requires authentication
set role = (select role from users natural join user_sessions where session_token = sqlpage.cookie('session_token'));
select 'redirect' as component, 'login.sql' as link where $role is null;
set user_role = (select role from users natural join user_sessions where session_token = sqlpage.cookie('session_token'));
select 'redirect' as component, 'login.sql' as link where $user_role is null;

select 'dynamic' as component,
json_insert(properties, '$[0].menu_item[#]', 'logout') as properties
FROM example WHERE component = 'shell' LIMIT 1;

select 'alert' as component, 'info' as color, CONCAT('You are logged in as ', $role) as title;
select 'alert' as component, 'info' as color, CONCAT('You are logged in as ', $user_role) as title;

select 'text' as component, '
# Authentication
Expand Down

0 comments on commit dd3d9a2

Please sign in to comment.