2018-11-18 11:00:15 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2020-04-22 19:07:51 +05:30
|
|
|
module CrudPolicyHelpers
|
|
|
|
extend ActiveSupport::Concern
|
|
|
|
|
|
|
|
class_methods do
|
2018-05-09 12:01:36 +05:30
|
|
|
def create_read_update_admin_destroy(name)
|
|
|
|
[
|
|
|
|
:"read_#{name}",
|
|
|
|
*create_update_admin_destroy(name)
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_update_admin_destroy(name)
|
2020-10-24 23:57:45 +05:30
|
|
|
[
|
|
|
|
*create_update_admin(name),
|
|
|
|
:"destroy_#{name}"
|
|
|
|
]
|
|
|
|
end
|
|
|
|
|
|
|
|
def create_update_admin(name)
|
2018-05-09 12:01:36 +05:30
|
|
|
[
|
|
|
|
:"create_#{name}",
|
|
|
|
:"update_#{name}",
|
2020-10-24 23:57:45 +05:30
|
|
|
:"admin_#{name}"
|
2018-05-09 12:01:36 +05:30
|
|
|
]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|