feat(gaurds): use better smartguards to verify action authorization
This commit is contained in:
9
ts/demo/demo.data.users.ts
Normal file
9
ts/demo/demo.data.users.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export const users = [
|
||||
{
|
||||
id: 'user1',
|
||||
data: {
|
||||
username: 'admin',
|
||||
password: 'password',
|
||||
}
|
||||
}
|
||||
]
|
@ -35,4 +35,17 @@ export const installDemoData = async (cloudlyRef: Cloudly) => {
|
||||
await cluster.delete();
|
||||
}
|
||||
|
||||
// ================================================================================
|
||||
// USERS
|
||||
const users = await cloudlyRef.authManager.CUser.getInstances({});
|
||||
for (const user of users) {
|
||||
await user.delete();
|
||||
}
|
||||
|
||||
const demoDataUsers = await import('./demo.data.users.js');
|
||||
for (const user of demoDataUsers.users) {
|
||||
const userInstance = new cloudlyRef.authManager.CUser();
|
||||
Object.assign(userInstance, user);
|
||||
await userInstance.save();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user