diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-09-15 19:31:39 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-09-15 19:31:39 +0000 |
commit | f809e76743a6ccab2badf69633bb6132c1358f2e (patch) | |
tree | 3ceb4064ab919406671f5a10b201b5e9a8972ccf /engine/classes/AccessControlQueryComponent.php | |
parent | 3d7c1441ea3ba018f2bb68be986d08d15aea6374 (diff) | |
download | elgg-f809e76743a6ccab2badf69633bb6132c1358f2e.tar.gz elgg-f809e76743a6ccab2badf69633bb6132c1358f2e.tar.bz2 |
Refs #2220: Pulled remaining classes out of lib files. Core classes now autoloaded via __autoload().
git-svn-id: http://code.elgg.org/elgg/trunk@6941 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/classes/AccessControlQueryComponent.php')
-rw-r--r-- | engine/classes/AccessControlQueryComponent.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/engine/classes/AccessControlQueryComponent.php b/engine/classes/AccessControlQueryComponent.php new file mode 100644 index 000000000..ad5410ddc --- /dev/null +++ b/engine/classes/AccessControlQueryComponent.php @@ -0,0 +1,40 @@ +<?php
+/**
+ * @class AccessControlQueryComponent
+ * Access control component.
+ * @author Curverider Ltd
+ * @see Query
+ */
+class AccessControlQueryComponent extends QueryComponent
+{
+ /**
+ * Construct the ACL.
+ *
+ * @param string $acl_table The table where the access control field is.
+ * @param string $acl_field The field containing the access control.
+ * @param string $object_owner_table The table containing the owner information for the stuff you're retrieving.
+ * @param string $object_owner_id_field The field in $object_owner_table containing the owner information
+ */
+ function __construct($acl_table = "entities", $acl_field = "access_id", $object_owner_table = "entities", $object_owner_id_field = "owner_guid")
+ {
+ global $CONFIG;
+
+ $this->acl_table = $CONFIG->dbprefix . sanitise_string($acl_table);
+ $this->acl_field = sanitise_string($acl_field);
+ $this->object_owner_table = $CONFIG->dbprefix . sanitise_string($object_owner_table);
+ $this->object_owner_id_field = sanitise_string($object_owner_id_field);
+ }
+
+ function __toString()
+ {
+ //$access = get_access_list();
+ // KJ - changed to use get_access_sql_suffix
+ // Note: currently get_access_sql_suffix is hardwired to use
+ // $acl_field = "access_id", $object_owner_table = $acl_table, and
+ // $object_owner_id_field = "owner_guid"
+ // @todo recode get_access_sql_suffix to make it possible to specify alternate field names
+ return "and ".get_access_sql_suffix($this->acl_table); // Add access controls
+
+ //return "and ({$this->acl_table}.{$this->acl_field} in {$access} or ({$this->acl_table}.{$this->acl_field} = 0 and {$this->object_owner_table}.{$this->object_owner_id_field} = {$_SESSION['id']}))";
+ }
+}
|