21 lines
516 B
Ruby
21 lines
516 B
Ruby
module Admin::ModuleAppHelper
|
|
|
|
def if_permit_to_delete(item)
|
|
case item.downcase
|
|
when :manager
|
|
current_user.admin?
|
|
when :sub_manager
|
|
@module_app.managing_users.include?(current_user) || current_user.admin?
|
|
end
|
|
end
|
|
|
|
def if_permit_to_assign(item)
|
|
if_permit_to_delete(item)
|
|
end
|
|
|
|
def get_auth_by(manager_obj)
|
|
showing_name = manager_obj.rule_creator==current_user ? t('me') : manager_obj.rule_creator.name
|
|
t("auth.auth_by",:user_display_name => showing_name)
|
|
end
|
|
end
|