lib/acl9/controller_extensions/dsl_base.rb in be9-acl9-0.10.0 vs lib/acl9/controller_extensions/dsl_base.rb in be9-acl9-0.11.0
- old
+ new
@@ -93,25 +93,29 @@
@denys << squash.call(subsidiary.denys) if subsidiary.denys.size > 0
end
alias action actions
+ def logged_in; false end
def anonymous; nil end
def all; true end
- def logged_in; false end
+ alias everyone all
+ alias everybody all
+ alias anyone all
+
def _parse_and_add_rule(*args)
options = args.extract_options!
_set_action_clause(options.delete(:to), options.delete(:except))
object = _role_object(options)
role_checks = args.map do |who|
case who
- when nil then "#{_subject_ref}.nil?" # anonymous
- when false then "!#{_subject_ref}.nil?" # logged_in
- when true then "true" # all
+ when anonymous() then "#{_subject_ref}.nil?"
+ when logged_in() then "!#{_subject_ref}.nil?"
+ when all() then "true"
else
"!#{_subject_ref}.nil? && #{_subject_ref}.has_role?('#{who.to_s.singularize}', #{object})"
end
end