开发者

rails 3 - devise block user to login

开发者 https://www.devze.com 2023-04-05 08:50 出处:网络
i have something in mind, i have some user types, Building owner, building manager. I want to create user as building manager, but i dont want they have access to login system. this user are only fo

i have something in mind, i have some user types, Building owner, building manager.

I want to create user as building manager, but i dont want they have access to login system. this user are only for some selectbox in my website, but i need to show them in my user index page.

what i think i can do is create normal user and with a before_save i create a new data in another table.

In a request i need to be able to setup in my building form more than one building manager. maybe the best are with nested form.. I think i will开发者_运维技巧 need to add building id to my user table. maybe they can be assigned more than one building.

for now, my db structure are like this :

table users with user data (username, password, email, first and last name, phone)
table usertype have userid, typename and accesslvl

But this problem give me some managing problem. They will not be associated with user data.

How can i resolve this? Does Device can block some user? I searched in the Devise docs, but nothing found.

Thanks for your help.


There is an approach where admin users can approve other user accounts for login. You could use a similar approach but programmatically approve the accounts you actually want to allow logins for. Details are here:

https://github.com/plataformatec/devise/wiki/How-To:-Require-admin-to-activate-account-before-sign_in

0

精彩评论

暂无评论...
验证码 换一张
取 消