diff options
author | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-05 19:20:17 +0000 |
---|---|---|
committer | ben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2008-08-05 19:20:17 +0000 |
commit | 8422a0502f87ff85c0898287a3578cf387965586 (patch) | |
tree | c97ecea8e7b378651e62526f427476fc205970b5 /engine | |
parent | e02e8f05a0e4d097a964cf9869119bd0f0e2a2e3 (diff) | |
download | elgg-8422a0502f87ff85c0898287a3578cf387965586.tar.gz elgg-8422a0502f87ff85c0898287a3578cf387965586.tar.bz2 |
Fixed group-specific access controls, and site-specific access controls
git-svn-id: https://code.elgg.org/elgg/trunk@1720 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine')
-rw-r--r-- | engine/lib/access.php | 15 | ||||
-rw-r--r-- | engine/lib/group.php | 6 |
2 files changed, 9 insertions, 12 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php index 29f87a1f8..d9f48e6e2 100644 --- a/engine/lib/access.php +++ b/engine/lib/access.php @@ -24,7 +24,6 @@ function get_access_list($user_id = 0, $site_id = 0, $flush = false) {
global $CONFIG;
- static $access_list;
if (!isset($access_list))
$access_list = array();
@@ -34,11 +33,7 @@ $user_id = (int) $user_id;
$site_id = (int) $site_id;
- if (empty($access_list[$user_id]) || $flush == true) {
-
- $access_list[$user_id] = "(" . implode(",",get_access_array($user_id, $site_id, $flush)) . ")";
-
- }
+ $access_list[$user_id] = "(" . implode(",",get_access_array($user_id, $site_id, $flush)) . ")";
return $access_list[$user_id];
@@ -55,13 +50,13 @@ function get_access_array($user_id = 0, $site_id = 0, $flush = false) {
global $CONFIG;
- static $access_array;
if (!isset($access_array))
$access_array = array();
if ($user_id == 0) $user_id = $_SESSION['guid'];
- if (($site_id == 0) && (isset($CONFIG->site_id))) $site_id = $CONFIG->site_id;
+
+ if (($site_id == 0) && (isset($CONFIG->site_guid))) $site_id = $CONFIG->site_guid;
$user_id = (int) $user_id;
$site_id = (int) $site_id;
@@ -188,6 +183,8 @@ */
function create_access_collection($name, $owner_guid = 0, $site_guid = 0) {
+ global $CONFIG;
+
$name = trim($name);
if (empty($name)) return false;
@@ -195,8 +192,6 @@ if (($site_id == 0) && (isset($CONFIG->site_id))) $site_id = $CONFIG->site_id;
$name = sanitise_string($name);
- global $CONFIG;
-
return insert_data("insert into {$CONFIG->dbprefix}access_collections set name = '{$name}', owner_guid = {$owner_guid}, site_guid = {$site_guid}");
}
diff --git a/engine/lib/group.php b/engine/lib/group.php index 2556001c5..5c09a93d9 100644 --- a/engine/lib/group.php +++ b/engine/lib/group.php @@ -765,7 +765,8 @@ * @param int $user_guid The user. */ function join_group($group_guid, $user_guid) - { + {
+ trigger_elgg_event('join','group',array('group' => get_entity($group_guid), 'user' => get_entity($user_guid))); return add_entity_relationship($user_guid, 'member', $group_guid); } @@ -776,7 +777,8 @@ * @param int $user_guid The user. */ function leave_group($group_guid, $user_guid) - { + {
+ trigger_elgg_event('leave','group',array('group' => get_entity($group_guid), 'user' => get_entity($user_guid))); return remove_entity_relationship($user_guid, 'member', $group_guid); } |