Skip to content

Commit

Permalink
mod_acl_user_groups: Fix non-admins denied permission to upload file (#…
Browse files Browse the repository at this point in the history
…1665)

(cherry picked from commit ac7094d)
  • Loading branch information
ddeboer committed May 1, 2017
1 parent e32c52c commit 3e2d622
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions modules/mod_admin/actions/action_admin_dialog_media_upload.erl
Expand Up @@ -109,17 +109,21 @@ event(#submit{message={media_url, EventProps}}, Context) ->


add_content_group(EventProps, Props, Context) ->
case proplists:get_value(subject_id, EventProps) of
case content_group_id(
proplists:get_value(content_group_id, EventProps),
proplists:get_value(subject_id, EventProps),
Context
) of
undefined ->
[ {content_group_id, proplists:get_value(content_group_id, EventProps)} | Props ];
SubjectId when is_integer(SubjectId) ->
ContentGroupdId = case proplists:get_value(content_group_id, EventProps) of
undefined -> m_rsc:p_no_acl(SubjectId, content_group_id, Context);
CGId -> CGId
end,
[ {content_group_id, ContentGroupdId} | Props ]
Props;
ContentGroupId ->
[{content_group_id, ContentGroupId} | Props]
end.

content_group_id(undefined, SubjectId, Context) when is_integer(SubjectId) ->
m_rsc:p_no_acl(SubjectId, content_group_id, Context);
content_group_id(ContentGroupId, _SubjectId, _Context) ->
ContentGroupId.

%% Handling the media upload.
handle_media_upload(EventProps, Context, InsertFun, ReplaceFun) ->
Expand Down

0 comments on commit 3e2d622

Please sign in to comment.