2013-09-26 49 views
0

我正在開發一個Web門戶,並希望實現註冊機制,在這裏將激活具有某些特質的人員使用門戶。Rails Gem在註冊時激活選定的用戶?

這裏有兩件事我要找:

1] 
    As a simple example, anyone who went to stanford and berkley could use it (So email should have @stanford.edu OR Linkedin Profile should indicated similar etc) . This could be extended to other similar constraints. 

    For now, its fine if I have to manually visit LinkedIn page, or exchange some emails before the approval is done. 

    2] 
    Some users with a pre-generated code are allowed to signup irrespective of above constraints. Eg a Gift card that has a membership pre-approved. 

3] 
This is not important , but there could be some pages/routes that could be available to everyone without approval. 

我要尋找一個寶石來執行這項任務還是如何能夠迅速而輕鬆地實現任何建議。如果解決方案只是擴展到10K用戶,那很好。

謝謝!

PS: 目前我使用的設計和全方位AUTH支持的認證,所以甚至會更好,如果那些能夠在新的解決方案來支持

回答

0

按照Devise Wiki Page on Approvals用於批准的初始設置過程,當新用戶通過AdminMailer郵件程序註冊時,它會通知您(或您選擇的任何人)。

然後,通過利用before_create回調,您可以檢查您的自定義的驗證,即:

def approved_via_linked_in? 
    # perform logic here... 
end 

而且,您可以設置電子郵件消息的情況下,其會從你的AdminMailer發送只發送當該用戶尚未被您的自定義驗證批准。