简体   繁体   English

当管理员角色应该能够创建子帐户时,如何在 Angular/Ionic 中使用 firebase 编写基于角色的身份验证?

[英]How is it possbible to program a role based authentication with firebase in Angular/Ionic, when the admin role should be able to create subaccounts?

So basically i have to program an app in Angular with ionic.所以基本上我必须用离子在 Angular 中编写一个应用程序。 There should be a admin account which should be able to create an account.应该有一个管理员帐户,应该能够创建一个帐户。 This admin account should then be able to create subaccounts with the email and then there should be generated an temporary password for the subaccount.然后,此管理员帐户应该能够使用 email 创建子帐户,然后应该为子帐户生成一个临时密码。

I am pretty new to Angular/Ionic so sorry for my question.我对 Angular/Ionic 很陌生,很抱歉我的问题。 Thanks!!谢谢!!

Like Aaron wrote in comment let users create thair accounts.就像 Aaron 在评论中所写的那样,让用户创建泰国帐户。 If you wana have controll over accaunts just make a firebase function with will disable account as soon as user create it then moderator or admin can change this status.如果您想控制帐户,只需创建 firebase function 即可在用户创建帐户后禁用帐户,然后版主或管理员可以更改此状态。

Here is an triger function:这是一个触发器 function:

exports.sendWelcomeEmail = functions.auth.user().onCreate((user) => {
  // To Do: Set user as disabled
});

More information you can find in a documentation: https://firebase.google.com/docs/functions/auth-events您可以在文档中找到更多信息: https://firebase.google.com/docs/functions/auth-events

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM