Commit 53229c0f authored by Tugce Nur Tas's avatar Tugce Nur Tas Committed by Tuğçe Nur Taş
Browse files

add destroy method for user and update user policy

parent 7986e47a
......@@ -46,6 +46,14 @@ class UsersController < ApplicationController
authorize @user
end
def destroy
authorize @user
@user.destroy
respond_to do |format|
format.html { redirect_to users_url, notice: t('user_destroyed') }
end
end
private
def set_user
......
......@@ -29,4 +29,8 @@ class UserPolicy < ApplicationPolicy
def update?
@current_user.superadmin? || @current_user == @user
end
def destroy?
@current_user.admin_or_superadmin?
end
end
......@@ -312,5 +312,6 @@ de:
show_profile: Profil anzeigen
when: Zeit
users: Benutzer
user_destroyed: Benutzer wurde erfolgreich gelöscht.
voluntary_platform: Freiwilligen Plattform
working_days: Arbeitstage
......@@ -210,6 +210,7 @@ en:
show_profile: Show profile
show_my_profile: My profile
users: Users
user_destroyed: User was successfully deleted.
voluntary_platform: Voluntaries Platform
when: Time
working_days: Working days
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment