Permalink
Browse files

mod_acl_*: Do not crash when undefined ACL object is passed in.

  • Loading branch information...
1 parent e9dc599 commit 9f107229889acaff4c045aa910b72b3cdee34651 @arjan arjan committed Nov 30, 2012
@@ -38,6 +38,8 @@
-include("zotonic.hrl").
%% @doc Check if the user is allowed to perform Action on Object
+observe_acl_is_allowed(#acl_is_allowed{object=undefined}, _Context) ->
+ undefined;
observe_acl_is_allowed(#acl_is_allowed{action=view, object=Id}, #context{user_id=undefined} = Context) ->
Acl = m_rsc:get_acl_props(Id, Context),
case Acl#acl_props.is_published of
@@ -50,6 +50,8 @@
%% @doc Check if the user is allowed to perform Action on Object
%% @todo #acl_edge
+observe_acl_is_allowed(#acl_is_allowed{object=undefined}, _Context) ->
+ undefined;
observe_acl_is_allowed(#acl_is_allowed{action=view, object=Id}, #context{user_id=undefined} = Context) ->
is_view_public(Id, Context);
observe_acl_is_allowed(#acl_is_allowed{}, #context{user_id=undefined}) ->

0 comments on commit 9f10722

Please sign in to comment.