summaryrefslogtreecommitdiff
path: root/classes/Profile.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-03-04 06:07:28 -0800
committerBrion Vibber <brion@pobox.com>2010-03-04 06:07:28 -0800
commitb218aee94e581230e1efa14d4ae1a19756986ddf (patch)
treea832ddf3b4322b520fd20c4d8ea2d31720c3679b /classes/Profile.php
parent358556057a87c0cb9291223a2026782e6548ff2e (diff)
parent14d7f4a598d0e24467fe3eafd9a02b0e651edad8 (diff)
Merge commit 'origin/testing' into 0.9.x
Conflicts: lib/action.php lib/adminpanelaction.php
Diffstat (limited to 'classes/Profile.php')
-rw-r--r--classes/Profile.php30
1 files changed, 30 insertions, 0 deletions
diff --git a/classes/Profile.php b/classes/Profile.php
index 470ef3320..0322c9358 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -282,6 +282,32 @@ class Profile extends Memcached_DataObject
}
}
+ function getGroups($offset=0, $limit=null)
+ {
+ $qry =
+ 'SELECT user_group.* ' .
+ 'FROM user_group JOIN group_member '.
+ 'ON user_group.id = group_member.group_id ' .
+ 'WHERE group_member.profile_id = %d ' .
+ 'ORDER BY group_member.created DESC ';
+
+ if ($offset>0 && !is_null($limit)) {
+ if ($offset) {
+ if (common_config('db','type') == 'pgsql') {
+ $qry .= ' LIMIT ' . $limit . ' OFFSET ' . $offset;
+ } else {
+ $qry .= ' LIMIT ' . $offset . ', ' . $limit;
+ }
+ }
+ }
+
+ $groups = new User_group();
+
+ $cnt = $groups->query(sprintf($qry, $this->id));
+
+ return $groups;
+ }
+
function avatarUrl($size=AVATAR_PROFILE_SIZE)
{
$avatar = $this->getAvatar($size);
@@ -717,6 +743,10 @@ class Profile extends Memcached_DataObject
case Right::CONFIGURESITE:
$result = $this->hasRole(Profile_role::ADMINISTRATOR);
break;
+ case Right::GRANTROLE:
+ case Right::REVOKEROLE:
+ $result = $this->hasRole(Profile_role::OWNER);
+ break;
case Right::NEWNOTICE:
case Right::NEWMESSAGE:
case Right::SUBSCRIBE: