Elgg  Version 1.9
access.php
Go to the documentation of this file.
1 <?php
43 function elgg_set_ignore_access($ignore = true) {
44  $cache = _elgg_get_access_cache();
45  $cache->clear();
46  $elgg_access = elgg_get_access_object();
47  return $elgg_access->setIgnoreAccess($ignore);
48 }
49 
58  return elgg_get_access_object()->getIgnoreAccess();
59 }
60 
72  static $access_cache;
73 
74  if (!$access_cache) {
75  $access_cache = new ElggStaticVariableCache('access');
76  }
77 
78  return $access_cache;
79 }
80 
96 function get_access_list($user_guid = 0, $site_guid = 0, $flush = false) {
98  $cache = _elgg_get_access_cache();
99 
100  if ($flush) {
101  $cache->clear();
102  }
103 
104  if ($user_guid == 0) {
106  }
107 
108  if (($site_guid == 0) && (isset($CONFIG->site_id))) {
109  $site_guid = $CONFIG->site_id;
110  }
111  $user_guid = (int) $user_guid;
112  $site_guid = (int) $site_guid;
113 
114  $hash = $user_guid . $site_guid . 'get_access_list';
115 
116  if ($cache[$hash]) {
117  return $cache[$hash];
118  }
119 
120  $access_array = get_access_array($user_guid, $site_guid, $flush);
121  $access = "(" . implode(",", $access_array) . ")";
122 
123  if ($init_finished) {
124  $cache[$hash] = $access;
125  }
126 
127  return $access;
128 }
129 
155 function get_access_array($user_guid = 0, $site_guid = 0, $flush = false) {
157 
158  $cache = _elgg_get_access_cache();
159 
160  if ($flush) {
161  $cache->clear();
162  }
163 
164  if ($user_guid == 0) {
166  }
167 
168  if (($site_guid == 0) && (isset($CONFIG->site_guid))) {
169  $site_guid = $CONFIG->site_guid;
170  }
171 
172  $user_guid = (int) $user_guid;
173  $site_guid = (int) $site_guid;
174 
175  $hash = $user_guid . $site_guid . 'get_access_array';
176 
177  if ($cache[$hash]) {
178  $access_array = $cache[$hash];
179  } else {
180  $access_array = array(ACCESS_PUBLIC);
181 
182  // The following can only return sensible data for a known user.
183  if ($user_guid) {
184  $access_array[] = ACCESS_LOGGED_IN;
185 
186  // Get ACL memberships
187  $query = "SELECT am.access_collection_id"
188  . " FROM {$CONFIG->dbprefix}access_collection_membership am"
189  . " LEFT JOIN {$CONFIG->dbprefix}access_collections ag ON ag.id = am.access_collection_id"
190  . " WHERE am.user_guid = $user_guid AND (ag.site_guid = $site_guid OR ag.site_guid = 0)";
191 
192  $collections = get_data($query);
193  if ($collections) {
194  foreach ($collections as $collection) {
195  if (!empty($collection->access_collection_id)) {
196  $access_array[] = (int)$collection->access_collection_id;
197  }
198  }
199  }
200 
201  // Get ACLs owned.
202  $query = "SELECT ag.id FROM {$CONFIG->dbprefix}access_collections ag ";
203  $query .= "WHERE ag.owner_guid = $user_guid AND (ag.site_guid = $site_guid OR ag.site_guid = 0)";
204 
205  $collections = get_data($query);
206  if ($collections) {
207  foreach ($collections as $collection) {
208  if (!empty($collection->id)) {
209  $access_array[] = (int)$collection->id;
210  }
211  }
212  }
213 
214  $ignore_access = elgg_check_access_overrides($user_guid);
215 
216  if ($ignore_access == true) {
217  $access_array[] = ACCESS_PRIVATE;
218  }
219  }
220 
221  if ($init_finished) {
222  $cache[$hash] = $access_array;
223  }
224  }
225 
226  $options = array(
227  'user_id' => $user_guid,
228  'site_id' => $site_guid
229  );
230 
231  // see the warning in the docs for this function about infinite loop potential
232  return elgg_trigger_plugin_hook('access:collections:read', 'user', $options, $access_array);
233 }
234 
247  global $CONFIG;
248 
249  // site default access
250  $default_access = $CONFIG->default_access;
251 
252  // user default access if enabled
253  if ($CONFIG->allow_user_default_access) {
255  if ($user) {
256  $user_access = $user->getPrivateSetting('elgg_default_access');
257  if ($user_access !== null) {
258  $default_access = $user_access;
259  }
260  }
261  }
262 
263  $params = array(
264  'user' => $user,
265  'default_access' => $default_access,
266  );
267  return elgg_trigger_plugin_hook('default', 'access', $params, $default_access);
268 }
269 
278 
286 function access_show_hidden_entities($show_hidden) {
288  $current_value = $ENTITY_SHOW_HIDDEN_OVERRIDE;
289  $ENTITY_SHOW_HIDDEN_OVERRIDE = $show_hidden;
290  return $current_value;
291 }
292 
302 }
303 
343 function _elgg_get_access_where_sql(array $options = array()) {
345 
346  $defaults = array(
347  'table_alias' => 'e',
348  'user_guid' => elgg_get_logged_in_user_guid(),
349  'use_enabled_clause' => !$ENTITY_SHOW_HIDDEN_OVERRIDE,
350  'access_column' => 'access_id',
351  'owner_guid_column' => 'owner_guid',
352  'guid_column' => 'guid',
353  );
354 
355  $options = array_merge($defaults, $options);
356 
357  // just in case someone passes a . at the end
358  $options['table_alias'] = rtrim($options['table_alias'], '.');
359 
360  foreach (array('table_alias', 'access_column', 'owner_guid_column', 'guid_column') as $key) {
362  }
363  $options['user_guid'] = sanitize_int($options['user_guid'], false);
364 
365  // only add dot if we have an alias or table name
366  $table_alias = $options['table_alias'] ? $options['table_alias'] . '.' : '';
367 
368  $options['ignore_access'] = elgg_check_access_overrides($options['user_guid']);
369 
370  $clauses = array(
371  'ors' => array(),
372  'ands' => array()
373  );
374 
375  if ($options['ignore_access']) {
376  $clauses['ors'][] = '1 = 1';
377  } else if ($options['user_guid']) {
378  // include content of user's friends
379  $clauses['ors'][] = "$table_alias{$options['access_column']} = " . ACCESS_FRIENDS . "
380  AND $table_alias{$options['owner_guid_column']} IN (
381  SELECT guid_one FROM {$CONFIG->dbprefix}entity_relationships
382  WHERE relationship = 'friend' AND guid_two = {$options['user_guid']}
383  )";
384 
385  // include user's content
386  $clauses['ors'][] = "$table_alias{$options['owner_guid_column']} = {$options['user_guid']}";
387  }
388 
389  // include standard accesses (public, logged in, access collections)
390  if (!$options['ignore_access']) {
391  $access_list = get_access_list($options['user_guid']);
392  $clauses['ors'][] = "$table_alias{$options['access_column']} IN {$access_list}";
393  }
394 
395  if ($options['use_enabled_clause']) {
396  $clauses['ands'][] = "{$table_alias}enabled = 'yes'";
397  }
398 
399  $clauses = elgg_trigger_plugin_hook('get_sql', 'access', $options, $clauses);
400 
401  $clauses_str = '';
402  if (is_array($clauses['ors']) && $clauses['ors']) {
403  $clauses_str = '(' . implode(' OR ', $clauses['ors']) . ')';
404  }
405 
406  if (is_array($clauses['ands']) && $clauses['ands']) {
407  if ($clauses_str) {
408  $clauses_str .= ' AND ';
409  }
410  $clauses_str .= '(' . implode(' AND ', $clauses['ands']) . ')';
411  }
412 
413  return "($clauses_str)";
414 }
415 
435 function has_access_to_entity($entity, $user = null) {
436  global $CONFIG;
437 
438  // See #7159. Must not allow ignore access to affect query
439  $ia = elgg_set_ignore_access(false);
440 
441  if (!isset($user)) {
442  $access_bit = _elgg_get_access_where_sql();
443  } else {
444  $access_bit = _elgg_get_access_where_sql(array('user_guid' => $user->getGUID()));
445  }
446 
448 
449  $query = "SELECT guid from {$CONFIG->dbprefix}entities e WHERE e.guid = " . $entity->getGUID();
450  // Add access controls
451  $query .= " AND " . $access_bit;
452  if (get_data($query)) {
453  return true;
454  } else {
455  return false;
456  }
457 }
458 
484 function get_write_access_array($user_guid = 0, $site_guid = 0, $flush = false) {
486  $cache = _elgg_get_access_cache();
487 
488  if ($flush) {
489  $cache->clear();
490  }
491 
492  if ($user_guid == 0) {
494  }
495 
496  if (($site_guid == 0) && (isset($CONFIG->site_id))) {
497  $site_guid = $CONFIG->site_id;
498  }
499 
500  $user_guid = (int) $user_guid;
501  $site_guid = (int) $site_guid;
502 
503  $hash = $user_guid . $site_guid . 'get_write_access_array';
504 
505  if ($cache[$hash]) {
506  $access_array = $cache[$hash];
507  } else {
508  // @todo is there such a thing as public write access?
509  $access_array = array(
510  ACCESS_PRIVATE => elgg_echo("PRIVATE"),
511  ACCESS_FRIENDS => elgg_echo("access:friends:label"),
512  ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
513  ACCESS_PUBLIC => elgg_echo("PUBLIC")
514  );
515 
516  $query = "SELECT ag.* FROM {$CONFIG->dbprefix}access_collections ag ";
517  $query .= " WHERE (ag.site_guid = $site_guid OR ag.site_guid = 0)";
518  $query .= " AND (ag.owner_guid = $user_guid)";
519 
520  $collections = get_data($query);
521  if ($collections) {
522  foreach ($collections as $collection) {
523  $access_array[$collection->id] = $collection->name;
524  }
525  }
526 
527  if ($init_finished) {
528  $cache[$hash] = $access_array;
529  }
530  }
531 
532  $options = array(
533  'user_id' => $user_guid,
534  'site_id' => $site_guid
535  );
536  return elgg_trigger_plugin_hook('access:collections:write', 'user',
537  $options, $access_array);
538 }
539 
555  if ($user_guid) {
556  $user = get_entity((int) $user_guid);
557  } else {
559  }
560 
562 
563  if (!($user instanceof ElggUser) || !$collection) {
564  return false;
565  }
566 
567  $write_access = get_write_access_array($user->getGUID(), 0, true);
568 
569  // don't ignore access when checking users.
570  if ($user_guid) {
571  return array_key_exists($collection_id, $write_access);
572  } else {
573  return elgg_get_ignore_access() || array_key_exists($collection_id, $write_access);
574  }
575 }
576 
596 function create_access_collection($name, $owner_guid = 0, $site_guid = 0) {
597  global $CONFIG;
598 
599  $name = trim($name);
600  if (empty($name)) {
601  return false;
602  }
603 
604  if ($owner_guid == 0) {
606  }
607  if (($site_guid == 0) && (isset($CONFIG->site_guid))) {
608  $site_guid = $CONFIG->site_guid;
609  }
611 
612  $q = "INSERT INTO {$CONFIG->dbprefix}access_collections
613  SET name = '{$name}',
614  owner_guid = {$owner_guid},
615  site_guid = {$site_guid}";
616  $id = insert_data($q);
617  if (!$id) {
618  return false;
619  }
620 
621  $params = array(
622  'collection_id' => $id
623  );
624 
625  if (!elgg_trigger_plugin_hook('access:collections:addcollection', 'collection', $params, true)) {
626  return false;
627  }
628 
629  return $id;
630 }
631 
650 
651  if (!$acl) {
652  return false;
653  }
654  $members = (is_array($members)) ? $members : array();
655 
656  $cur_members = get_members_of_access_collection($collection_id, true);
657  $cur_members = (is_array($cur_members)) ? $cur_members : array();
658 
659  $remove_members = array_diff($cur_members, $members);
660  $add_members = array_diff($members, $cur_members);
661 
662  $result = true;
663 
664  foreach ($add_members as $guid) {
666  }
667 
668  foreach ($remove_members as $guid) {
670  }
671 
672  return $result;
673 }
674 
685  global $CONFIG;
686 
688  $params = array('collection_id' => $collection_id);
689 
690  if (!elgg_trigger_plugin_hook('access:collections:deletecollection', 'collection', $params, true)) {
691  return false;
692  }
693 
694  // Deleting membership doesn't affect result of deleting ACL.
695  $q = "DELETE FROM {$CONFIG->dbprefix}access_collection_membership
696  WHERE access_collection_id = {$collection_id}";
697  delete_data($q);
698 
699  $q = "DELETE FROM {$CONFIG->dbprefix}access_collections
700  WHERE id = {$collection_id}";
701  $result = delete_data($q);
702 
703  return (bool)$result;
704 }
705 
719  global $CONFIG;
721 
722  $query = "SELECT * FROM {$CONFIG->dbprefix}access_collections WHERE id = {$collection_id}";
723  $get_collection = get_data_row($query);
724 
725  return $get_collection;
726 }
727 
741  global $CONFIG;
742 
744  $user_guid = (int) $user_guid;
746 
748 
749  if (!($user instanceof Elgguser) || !$collection) {
750  return false;
751  }
752 
753  $params = array(
754  'collection_id' => $collection_id,
755  'user_guid' => $user_guid
756  );
757 
758  $result = elgg_trigger_plugin_hook('access:collections:add_user', 'collection', $params, true);
759  if ($result == false) {
760  return false;
761  }
762 
763  // if someone tries to insert the same data twice, we do a no-op on duplicate key
764  $q = "INSERT INTO {$CONFIG->dbprefix}access_collection_membership
765  SET access_collection_id = $collection_id, user_guid = $user_guid
766  ON DUPLICATE KEY UPDATE user_guid = user_guid";
767  $result = insert_data($q);
768 
769  return $result !== false;
770 }
771 
785  global $CONFIG;
786 
788  $user_guid = (int) $user_guid;
790 
792 
793  if (!($user instanceof Elgguser) || !$collection) {
794  return false;
795  }
796 
797  $params = array(
798  'collection_id' => $collection_id,
799  'user_guid' => $user_guid
800  );
801 
802  if (!elgg_trigger_plugin_hook('access:collections:remove_user', 'collection', $params, true)) {
803  return false;
804  }
805 
806  $q = "DELETE FROM {$CONFIG->dbprefix}access_collection_membership
807  WHERE access_collection_id = {$collection_id}
808  AND user_guid = {$user_guid}";
809 
810  return (bool)delete_data($q);
811 }
812 
823 function get_user_access_collections($owner_guid, $site_guid = 0) {
824  global $CONFIG;
825  $owner_guid = (int) $owner_guid;
826  $site_guid = (int) $site_guid;
827 
828  if (($site_guid == 0) && (isset($CONFIG->site_guid))) {
829  $site_guid = $CONFIG->site_guid;
830  }
831 
832  $query = "SELECT * FROM {$CONFIG->dbprefix}access_collections
833  WHERE owner_guid = {$owner_guid}
834  AND site_guid = {$site_guid}
835  ORDER BY name ASC";
836 
837  $collections = get_data($query);
838 
839  return $collections;
840 }
841 
851 function get_members_of_access_collection($collection, $idonly = false) {
852  global $CONFIG;
853  $collection = (int)$collection;
854 
855  if (!$idonly) {
856  $query = "SELECT e.* FROM {$CONFIG->dbprefix}access_collection_membership m"
857  . " JOIN {$CONFIG->dbprefix}entities e ON e.guid = m.user_guid"
858  . " WHERE m.access_collection_id = {$collection}";
859  $collection_members = get_data($query, "entity_row_to_elggstar");
860  } else {
861  $query = "SELECT e.guid FROM {$CONFIG->dbprefix}access_collection_membership m"
862  . " JOIN {$CONFIG->dbprefix}entities e ON e.guid = m.user_guid"
863  . " WHERE m.access_collection_id = {$collection}";
864  $collection_members = get_data($query);
865  if (!$collection_members) {
866  return false;
867  }
868  foreach ($collection_members as $key => $val) {
869  $collection_members[$key] = $val->guid;
870  }
871  }
872 
873  return $collection_members;
874 }
875 
886 function elgg_get_entities_from_access_id(array $options = array()) {
887  // restrict the resultset to access collection provided
888  if (!isset($options['access_id'])) {
889  return false;
890  }
891 
892  // @todo add support for an array of collection_ids
893  $where = "e.access_id = '{$options['access_id']}'";
894  if (isset($options['wheres'])) {
895  if (is_array($options['wheres'])) {
896  $options['wheres'][] = $where;
897  } else {
898  $options['wheres'] = array($options['wheres'], $where);
899  }
900  } else {
901  $options['wheres'] = array($where);
902  }
903 
904  // return entities with the desired options
905  return elgg_get_entities($options);
906 }
907 
918 function elgg_list_entities_from_access_id(array $options = array()) {
919  return elgg_list_entities($options, 'elgg_get_entities_from_access_id');
920 }
921 
940 function get_readable_access_level($entity_access_id) {
941  $access = (int) $entity_access_id;
942 
943  // Check if entity access id is a defined global constant
944  $access_array = array(
945  ACCESS_PRIVATE => elgg_echo("PRIVATE"),
946  ACCESS_FRIENDS => elgg_echo("access:friends:label"),
947  ACCESS_LOGGED_IN => elgg_echo("LOGGED_IN"),
948  ACCESS_PUBLIC => elgg_echo("PUBLIC")
949  );
950 
951  if (array_key_exists($access, $access_array)) {
952  return $access_array[$access];
953  }
954 
955  // Entity access id is a custom access collection
956  // Check if the user has write access to it and can see it's label
957  $write_access_array = get_write_access_array();
958 
959  if (array_key_exists($access, $write_access_array)) {
960  return $write_access_array[$access];
961  }
962 
963  // return 'Limited' if the user does not have access to the access collection
964  return elgg_echo('access:limited:label');
965 }
966 
983  if (!$user_guid || $user_guid <= 0) {
984  $is_admin = false;
985  } else {
986  $is_admin = elgg_is_admin_user($user_guid);
987  }
988 
989  return ($is_admin || elgg_get_ignore_access());
990 }
991 
1003  static $elgg_access;
1004 
1005  if (!$elgg_access) {
1006  $elgg_access = new Elgg_Access();
1007  }
1008 
1009  return $elgg_access;
1010 }
1011 
1021 
1030 function access_init() {
1032  $init_finished = true;
1033 }
1034 
1056  $user = elgg_extract('user', $params);
1057  if ($user) {
1058  $user_guid = $user->getGUID();
1059  } else {
1061  }
1062 
1063  // don't do this so ignore access still works with no one logged in
1064  //if (!$user instanceof ElggUser) {
1065  // return false;
1066  //}
1067 
1068  // check for admin
1070  return true;
1071  }
1072 
1073  // check access overrides
1075  return true;
1076  }
1077 
1078  // consult other hooks
1079  return null;
1080 }
1081 
1093 function access_test($hook, $type, $value, $params) {
1094  global $CONFIG;
1095  $value[] = $CONFIG->path . 'engine/tests/ElggCoreAccessCollectionsTest.php';
1096  $value[] = $CONFIG->path . 'engine/tests/ElggCoreAccessSQLTest.php';
1097  return $value;
1098 }
1099 
1100 // Tell the access functions the system has booted, plugins are loaded,
1101 // and the user is logged in so it can start caching
1102 elgg_register_event_handler('ready', 'system', 'access_init');
1103 
1104 // For overrided permissions
1105 elgg_register_plugin_hook_handler('permissions_check', 'all', 'elgg_override_permissions');
1106 elgg_register_plugin_hook_handler('container_permissions_check', 'all', 'elgg_override_permissions');
1107 
1108 elgg_register_plugin_hook_handler('unit_test', 'system', 'access_test');
get_data_row($query, $callback="")
Retrieve a single row from the database.
Definition: database.php:66
get_access_array($user_guid=0, $site_guid=0, $flush=false)
Returns an array of access IDs a user is permitted to see.
Definition: access.php:155
delete_access_collection($collection_id)
Deletes a specified access collection and its membership.
Definition: access.php:684
if($guid==elgg_get_logged_in_user_guid()) $name
Definition: delete.php:21
access_init()
A quick and dirty way to make sure the access permissions have been correctly set up...
Definition: access.php:1030
$members
$value
Definition: longtext.php:29
$ia
Definition: upgrade.php:26
elgg_list_entities_from_access_id(array $options=array())
Lists entities from an access collection.
Definition: access.php:918
$guid
Removes an admin notice.
const ACCESS_FRIENDS
Definition: elgglib.php:2124
_elgg_get_access_cache()
Return an ElggCache static variable cache for the access caches.
Definition: access.php:68
$collection
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1464
elgg_register_plugin_hook_handler($hook, $type, $callback, $priority=500)
Register a callback as a plugin hook handler.
Definition: elgglib.php:853
delete_data($query)
Remove a row from the database.
Definition: database.php:106
get_access_collection($collection_id)
Get a specified access collection.
Definition: access.php:718
update_access_collection($collection_id, $members)
Updates the membership in an access collection.
Definition: access.php:648
access_test($hook, $type, $value, $params)
Runs unit tests for the access library.
Definition: access.php:1093
remove_user_from_access_collection($user_guid, $collection_id)
Removes a user from an access collection.
Definition: access.php:784
sanitize_string($string)
Sanitize a string for database use.
Definition: database.php:140
insert_data($query)
Insert a row into the database.
Definition: database.php:80
elgg_get_ignore_access()
Get current ignore access setting.
Definition: access.php:57
$params
Definition: login.php:72
$options
Definition: index.php:14
$owner_guid
get_user_access_collections($owner_guid, $site_guid=0)
Returns an array of database row objects of the access collections owned by $owner_guid.
Definition: access.php:823
$init_finished
A flag to set if Elgg&#39;s access initialization is finished.
Definition: access.php:1020
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_check_access_overrides($user_guid=0)
Decides if the access system should be ignored for a user.
Definition: access.php:982
get_user($guid)
Get a user object from a GUID.
Definition: users.php:222
$key
Definition: summary.php:34
get_members_of_access_collection($collection, $idonly=false)
Get all of members of an access collection.
Definition: access.php:851
elgg_set_ignore_access($ignore=true)
Set if Elgg&#39;s access system should be ignored.
Definition: access.php:43
add_user_to_access_collection($user_guid, $collection_id)
Adds a user to an access collection.
Definition: access.php:740
elgg_is_admin_user($user_guid)
Check if the given user has full access.
Definition: sessions.php:85
$ENTITY_SHOW_HIDDEN_OVERRIDE
Allow disabled entities and metadata to be returned by getter functions.
Definition: access.php:277
global $CONFIG
sanitise_string($string)
Wrapper function for alternate English spelling (.
Definition: database.php:150
$user
Definition: ban.php:13
const ACCESS_PRIVATE
Definition: elgglib.php:2121
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:777
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
Definition: elgglib.php:925
elgg global
Pointer to the global context.
Definition: elgglib.js:12
$type
Definition: add.php:8
get_access_list($user_guid=0, $site_guid=0, $flush=false)
Return a string of access_ids for $user_guid appropriate for inserting into an SQL IN clause...
Definition: access.php:96
get_readable_access_level($entity_access_id)
Return the name of an ACCESS_* constant or an access collection, but only if the logged in user has w...
Definition: access.php:940
access_get_show_hidden_status()
Return current status of showing disabled entities.
Definition: access.php:299
$collection_id
Definition: delete.php:9
elgg_register_event_handler($event, $object_type, $callback, $priority=500)
Register a callback as an Elgg event handler.
Definition: elgglib.php:669
elgg_list_entities(array $options=array(), $getter= 'elgg_get_entities', $viewer= 'elgg_view_entity_list')
Returns a string of rendered entities.
Definition: entities.php:1343
get_data($query, $callback="")
Retrieve rows from the database.
Definition: database.php:50
const ACCESS_PUBLIC
Definition: elgglib.php:2123
access_show_hidden_entities($show_hidden)
Show or hide disabled entities.
Definition: access.php:286
elgg_get_entities_from_access_id(array $options=array())
Return entities based upon access id.
Definition: access.php:886
has_access_to_entity($entity, $user=null)
Can a user access an entity.
Definition: access.php:435
elgg_get_access_object()
Returns the Elgg_Access object.
Definition: access.php:1002
can_edit_access_collection($collection_id, $user_guid=null)
Can the user change this access collection?
Definition: access.php:554
elgg_get_logged_in_user_entity()
Return the current logged in user, or null if no user is logged in.
Definition: sessions.php:32
get_default_access(ElggUser $user=null)
Gets the default access permission.
Definition: access.php:246
const ACCESS_LOGGED_IN
Definition: elgglib.php:2122
sanitize_int($int, $signed=true)
Sanitizes an integer for database use.
Definition: database.php:161
$user_guid
Avatar remove action.
Definition: remove.php:6
$defaults
Definition: access.php:19
_elgg_get_access_where_sql(array $options=array())
Returns the SQL where clause for enforcing read access to data.
Definition: access.php:343
if(!$collection_name) $id
Definition: add.php:17
elgg_get_logged_in_user_guid()
Return the current logged in user by guid.
Definition: sessions.php:42
get_write_access_array($user_guid=0, $site_guid=0, $flush=false)
Returns an array of access permissions that the user is allowed to save content with.
Definition: access.php:484
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604
$access
Definition: save.php:15
create_access_collection($name, $owner_guid=0, $site_guid=0)
Creates a new access collection.
Definition: access.php:596
elgg_override_permissions($hook, $type, $value, $params)
Overrides the access system if appropriate.
Definition: access.php:1055
$entity
Definition: access.php:26