mirror of
https://github.com/EasyTier/EasyTier.git
synced 2024-11-15 19:22:30 +08:00
8aca5851f2
Some checks failed
EasyTier Core / pre_job (push) Has been cancelled
EasyTier GUI / pre_job (push) Has been cancelled
EasyTier Mobile / pre_job (push) Has been cancelled
EasyTier Test / pre_job (push) Has been cancelled
EasyTier Core / build (freebsd-13.2-x86_64, 13.2, ubuntu-22.04, x86_64-unknown-freebsd) (push) Has been cancelled
EasyTier Core / build (linux-aarch64, ubuntu-22.04, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-arm, ubuntu-22.04, arm-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (linux-armhf, ubuntu-22.04, arm-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (linux-armv7, ubuntu-22.04, armv7-unknown-linux-musleabi) (push) Has been cancelled
EasyTier Core / build (linux-armv7hf, ubuntu-22.04, armv7-unknown-linux-musleabihf) (push) Has been cancelled
EasyTier Core / build (linux-mips, ubuntu-22.04, mips-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-mipsel, ubuntu-22.04, mipsel-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (linux-x86_64, ubuntu-22.04, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier Core / build (macos-aarch64, macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (macos-x86_64, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier Core / build (windows-x86_64, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier Core / core-result (push) Has been cancelled
EasyTier GUI / build-gui (linux-aarch64, aarch64-unknown-linux-gnu, ubuntu-22.04, aarch64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / build-gui (linux-x86_64, x86_64-unknown-linux-gnu, ubuntu-22.04, x86_64-unknown-linux-musl) (push) Has been cancelled
EasyTier GUI / build-gui (macos-aarch64, aarch64-apple-darwin, macos-latest, aarch64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (macos-x86_64, x86_64-apple-darwin, macos-latest, x86_64-apple-darwin) (push) Has been cancelled
EasyTier GUI / build-gui (windows-x86_64, x86_64-pc-windows-msvc, windows-latest, x86_64-pc-windows-msvc) (push) Has been cancelled
EasyTier GUI / gui-result (push) Has been cancelled
EasyTier Mobile / build-mobile (android, ubuntu-22.04, android) (push) Has been cancelled
EasyTier Mobile / mobile-result (push) Has been cancelled
EasyTier Test / test (push) Has been cancelled
https://apifox.com/apidoc/shared-ceda7a60-e817-4ea8-827b-de4e874dc45e implement all backend API
86 lines
2.4 KiB
SQL
86 lines
2.4 KiB
SQL
-- # Entity schema.
|
|
|
|
-- Create `users` table.
|
|
create table if not exists users (
|
|
id integer primary key autoincrement,
|
|
username text not null unique,
|
|
password text not null
|
|
);
|
|
|
|
-- Create `groups` table.
|
|
create table if not exists groups (
|
|
id integer primary key autoincrement,
|
|
name text not null unique
|
|
);
|
|
|
|
-- Create `permissions` table.
|
|
create table if not exists permissions (
|
|
id integer primary key autoincrement,
|
|
name text not null unique
|
|
);
|
|
|
|
|
|
-- # Join tables.
|
|
|
|
-- Create `users_groups` table for many-to-many relationships between users and groups.
|
|
create table if not exists users_groups (
|
|
user_id integer references users(id),
|
|
group_id integer references groups(id),
|
|
primary key (user_id, group_id)
|
|
);
|
|
|
|
-- Create `groups_permissions` table for many-to-many relationships between groups and permissions.
|
|
create table if not exists groups_permissions (
|
|
group_id integer references groups(id),
|
|
permission_id integer references permissions(id),
|
|
primary key (group_id, permission_id)
|
|
);
|
|
|
|
|
|
-- # Fixture hydration.
|
|
|
|
-- Insert "user" user. password: "user"
|
|
insert into users (username, password)
|
|
values (
|
|
'user',
|
|
'$argon2i$v=19$m=16,t=2,p=1$dHJ5dXZkYmZkYXM$UkrNqWz0BbSVBq4ykLSuJw'
|
|
);
|
|
|
|
-- Insert "admin" user. password: "admin"
|
|
insert into users (username, password)
|
|
values (
|
|
'admin',
|
|
'$argon2i$v=19$m=16,t=2,p=1$Ymd1Y2FlcnQ$x0q4oZinW9S1ZB9BcaHEpQ'
|
|
);
|
|
|
|
-- Insert "users" and "superusers" groups.
|
|
insert into groups (name) values ('users');
|
|
insert into groups (name) values ('superusers');
|
|
|
|
-- Insert individual permissions.
|
|
insert into permissions (name) values ('sessions');
|
|
insert into permissions (name) values ('devices');
|
|
|
|
-- Insert group permissions.
|
|
insert into groups_permissions (group_id, permission_id)
|
|
values (
|
|
(select id from groups where name = 'users'),
|
|
(select id from permissions where name = 'devices')
|
|
), (
|
|
(select id from groups where name = 'superusers'),
|
|
(select id from permissions where name = 'sessions')
|
|
);
|
|
|
|
-- Insert users into groups.
|
|
insert into users_groups (user_id, group_id)
|
|
values (
|
|
(select id from users where username = 'user'),
|
|
(select id from groups where name = 'users')
|
|
), (
|
|
(select id from users where username = 'admin'),
|
|
(select id from groups where name = 'users')
|
|
), (
|
|
(select id from users where username = 'admin'),
|
|
(select id from groups where name = 'superusers')
|
|
);
|