aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCash Costello <cash.costello@gmail.com>2009-03-28 15:20:08 +0000
committerCash Costello <cash.costello@gmail.com>2009-03-28 15:20:08 +0000
commita9010a793da35f76d01edbca97ec40079cc0a9e2 (patch)
tree6a1d5173ef6681abd2296c7bbcfc378761cea68c
parent91b909acb2708e256f4a653dc0b11cd796d00a62 (diff)
downloadelgg-a9010a793da35f76d01edbca97ec40079cc0a9e2.tar.gz
elgg-a9010a793da35f76d01edbca97ec40079cc0a9e2.tar.bz2
group members can now work with photo albums
-rw-r--r--edit.php2
-rw-r--r--start.php24
2 files changed, 25 insertions, 1 deletions
diff --git a/edit.php b/edit.php
index 0f099a9ad..b61f6ba0f 100644
--- a/edit.php
+++ b/edit.php
@@ -6,7 +6,7 @@
include_once(dirname(dirname(dirname(__FILE__))) . "/engine/start.php");
- gatekeeper();
+ gatekeeper(); // make sure the user is logged_in
set_context('photos');
$guid = (int) get_input('guid');
diff --git a/start.php b/start.php
index e2fbbe15e..dc1456a57 100644
--- a/start.php
+++ b/start.php
@@ -41,6 +41,8 @@
register_entity_type('object','album');
add_group_tool_option('photos',elgg_echo('tidypics:enablephotos'),true);
+
+ register_plugin_hook('permissions_check', 'object', 'tidypics_permission_override');
}
/**
@@ -170,7 +172,29 @@
}
}
+
+ /**
+ * Override permissions for group albums and images
+ *
+ */
+ function tidypics_permission_override($hook, $entity_type, $returnvalue, $params)
+ {
+ $entity = $params['entity'];
+ $user = $params['user'];
+ if ($entity->subtype == get_subtype_id('object', 'album')) {
+ // test that the user can edit the container
+ return can_write_to_container(0, $entity->container_guid);
+ }
+
+ if ($entity->subtype == get_subtype_id('object', 'image')) {
+ // test that the user can edit the container
+ return can_write_to_container(0, $entity->container_guid);
+ }
+
+ return false;
+ }
+
/**
* Populates the ->getUrl() method for file objects
*