From 792112a10ead7451933d2f9813ae050034b2b5a6 Mon Sep 17 00:00:00 2001 From: ben Date: Tue, 24 Feb 2009 10:49:26 +0000 Subject: Added fixes to create_entity and add_widgets to correctly handle containers. git-svn-id: https://code.elgg.org/elgg/trunk@2912 36083f99-b078-4883-b0ff-0f9b5a30f544 --- engine/lib/entities.php | 7 +++++-- engine/lib/widgets.php | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'engine/lib') diff --git a/engine/lib/entities.php b/engine/lib/entities.php index a873fa67a..3597040c9 100644 --- a/engine/lib/entities.php +++ b/engine/lib/entities.php @@ -1320,7 +1320,7 @@ if (!$container_guid) return true; $container = get_entity($container_guid); - + if (($container) && ($user)) { @@ -1368,7 +1368,10 @@ $site_guid = (int) $site_guid; if ($container_guid == 0) $container_guid = $owner_guid; - if (!can_write_to_container($owner_guid, $container_guid, $type)) return false; + $user = get_loggedin_user(); + if (!can_write_to_container($user->guid, $owner_guid, $type)) return false; + if ($owner_guid != $container_guid) + if (!can_write_to_container($user->guid, $container_guid, $type)) return false; if ($type=="") throw new InvalidParameterException(elgg_echo('InvalidParameterException:EntityTypeNotSet')); diff --git a/engine/lib/widgets.php b/engine/lib/widgets.php index a455f8068..02ef721e4 100644 --- a/engine/lib/widgets.php +++ b/engine/lib/widgets.php @@ -232,6 +232,7 @@ $widget = new ElggWidget; $widget->owner_guid = $user_guid; + $widget->container_guid = $user_guid; $widget->access_id = get_default_access(); // private widgets don't makes sense, correct? if ($widget->access_id == ACCESS_PRIVATE) -- cgit v1.2.3