aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/access.php
diff options
context:
space:
mode:
authorkevinjardine <kevinjardine@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-25 13:02:54 +0000
committerkevinjardine <kevinjardine@36083f99-b078-4883-b0ff-0f9b5a30f544>2009-02-25 13:02:54 +0000
commit8eb953ffe12d9d55e9f6c3e6c10e1d19e8477325 (patch)
treee6a69cc7ae810e4253d97a5bf48ca0c86ba32803 /engine/lib/access.php
parent6336f2176cf12e195248a96118d5513d79fc652c (diff)
downloadelgg-8eb953ffe12d9d55e9f6c3e6c10e1d19e8477325.tar.gz
elgg-8eb953ffe12d9d55e9f6c3e6c10e1d19e8477325.tar.bz2
Introduces user default access.
git-svn-id: https://code.elgg.org/elgg/trunk@2943 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/access.php')
-rw-r--r--engine/lib/access.php20
1 files changed, 17 insertions, 3 deletions
diff --git a/engine/lib/access.php b/engine/lib/access.php
index eb00d7543..2f9feae43 100644
--- a/engine/lib/access.php
+++ b/engine/lib/access.php
@@ -116,13 +116,27 @@
*
* @return int default access id (see ACCESS defines in elgglib.php)
*/
- function get_default_access()
+ function get_default_access($user=null)
{
global $CONFIG;
- // future: if user has a default access set, override site default access
+ if (!$CONFIG->allow_user_default_access) {
+ return $CONFIG->default_access;
+ }
+
+ if (!$user) {
+ if (isloggedin()) {
+ $user = $_SESSION['user'];
+ } else {
+ return $CONFIG->default_access;
+ }
+ }
- return $CONFIG->default_access;
+ if (false !== ($default_access = $user->getPrivateSetting('elgg_default_access'))) {
+ return $default_access;
+ } else {
+ return $CONFIG->default_access;
+ }
}
/**