Gokul595 / api_guard

JWT authentication solution for Rails APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ability to turn off routes / feature such as deleting accounts

gczh opened this issue · comments

Currently, I'd like to be able to use the api_guard gem to do the user authentication. However, I do not want users to be able to delete their accounts.

Is there anyway to configure this through the initializer? Or do I have to override the RegistrationController and use an empty def destroy action to prevent users from deleting their accounts?

Or should I be removing the routes dynamically in an initializer?

To skip only the destroy action, you can customize the routes as below:

api_guard_routes for: 'users', except: [:registration]

api_guard_scope 'users' do
  post 'users/sign_up' => 'api_guard/registration#create'
end