diff options
author | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-07-07 15:09:53 +0000 |
---|---|---|
committer | brettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2009-07-07 15:09:53 +0000 |
commit | eca0feb9a0380fb1e700af0d183f295fef55a05b (patch) | |
tree | fb08f59221593f93149ab9e01914e062cf1ea203 /mod/groups/start.php | |
parent | 8276e36bced4d6ea99b6aaea29f59b0252cd15f7 (diff) | |
download | elgg-eca0feb9a0380fb1e700af0d183f295fef55a05b.tar.gz elgg-eca0feb9a0380fb1e700af0d183f295fef55a05b.tar.bz2 |
Refs #1099: Using write access hook to allow group-only ACLs. Need to examine better solutions after 1.7.
git-svn-id: https://code.elgg.org/elgg/trunk@3395 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'mod/groups/start.php')
-rw-r--r-- | mod/groups/start.php | 40 |
1 files changed, 29 insertions, 11 deletions
diff --git a/mod/groups/start.php b/mod/groups/start.php index b7a99d5bc..57e0a9766 100644 --- a/mod/groups/start.php +++ b/mod/groups/start.php @@ -63,8 +63,9 @@ extend_view('profile/icon','groups/icon');
extend_view('css','groups/css');
- // Write access permissions
+ // Access permissions
register_plugin_hook('access:collections:write', 'all', 'groups_write_acl_plugin_hook');
+ //register_plugin_hook('access:collections:read', 'all', 'groups_read_acl_plugin_hook');
// Notification hooks
if (is_callable('register_notification_object'))
@@ -373,12 +374,18 @@ */
function groups_read_acl_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
-
//error_log("READ: " . var_export($returnvalue));
$user = $_SESSION['user'];
if ($user)
{
- $membership = get_users_membership($user->guid);
+ // Not using this because of recursion.
+ // Joining a group automatically add user to ACL,
+ // So just see if they're a member of the ACL.
+ //$membership = get_users_membership($user->guid);
+
+ $members = get_members_of_access_collection($group->group_acl);
+ print_r($members);
+ exit;
if ($membership)
{
@@ -395,16 +402,27 @@ function groups_write_acl_plugin_hook($hook, $entity_type, $returnvalue, $params)
{
$page_owner = page_owner_entity();
-
- if ($page_owner instanceof ElggGroup)
- {
- if (can_write_to_container())
- {
- $returnvalue[$page_owner->group_acl] = elgg_echo('groups:group') . ": " . $page_owner->name;
-
- return $returnvalue;
+ // get all groups if logged in
+ if ($loggedin = get_loggedin_user()) {
+ $groups = get_entities_from_relationship('member', $loggedin->getGUID());
+ if (is_array($groups)) {
+ foreach ($groups as $group) {
+ $returnvalue[$group->group_acl] = elgg_echo('groups:group') . ': ' . $group->name;
+ }
}
}
+
+ // This doesn't seem to do anything.
+ // There are no hooks to override container permissions for groups
+//
+// if ($page_owner instanceof ElggGroup)
+// {
+// if (can_write_to_container())
+// {
+// $returnvalue[$page_owner->group_acl] = elgg_echo('groups:group') . ": " . $page_owner->name;
+// }
+// }
+ return $returnvalue;
}
/**
|