6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/controllers/concerns/dradis/plugins/persistent_permissions.rb', line 6
def update
@user = User.authors.find(params[:id])
Permission.transaction do
Permission.where(component: self.class.component_name, user_id: params[:id]).destroy_all
permissions_params[:permissions]&.each do |permission|
next unless self.class.permissions_validation.call(permission) if self.class.permissions_validation
Permission.create!(
component: self.class.component_name,
name: permission,
user_id: params[:id]
)
end
end
redirect_to main_app.edit_admin_user_permissions_path(params[:id]), notice: "#{@user.name}'s permissions have been updated."
end
|