Skip to content

Commit

Permalink
Merge e4958a8 into 740595e
Browse files Browse the repository at this point in the history
  • Loading branch information
wtrv committed Oct 12, 2018
2 parents 740595e + e4958a8 commit 0b323aa
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 29 deletions.
26 changes: 3 additions & 23 deletions CultureFeed/CultureFeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -2139,23 +2139,13 @@ protected static function parseUser(CultureFeed_SimpleXMLElement $element) {

$user_membership = new CultureFeed_Pages_Membership();

$page = new CultureFeed_Cdb_Item_Page();
$page->setId($pageId);
$page->setName($membership->xpath_str('page/name'));

// Set categories
$categories_element = $membership->xpath('page/categoryIds/categoryId');
$categories = array();
foreach ($categories_element as $category) {
$categories[] = (string) $category;
}
$page->setCategories($categories);
$page = CultureFeed_Cdb_Item_Page::parseFromCdbXml($membership->xpath('page')[0]);

$user_membership->page = $page;
$user_membership->validated = $membership->xpath_bool('validated');
$user_membership->role = $membership->xpath_str('role');
$user_membership->relation = $membership->xpath_str('relation');
$user_membership->creationDate = $membership->xpath_time('creationDate');
$user_membership->creationDate = $membership->xpath_time('creationDate');


$user_memberships[] = $user_membership;
Expand Down Expand Up @@ -2186,17 +2176,7 @@ protected static function parseUser(CultureFeed_SimpleXMLElement $element) {

$follower = new CultureFeed_Pages_Follower();

$page = new CultureFeed_Cdb_Item_Page();
$page->setId($pageId);
$page->setName($object->xpath_str('name'));

// Set categories
$categories_element = $object->xpath('categoryIds/categoryId');
$categories = array();
foreach ($categories_element as $category) {
$categories[] = (string) $category;
}
$page->setCategories($categories);
$page = CultureFeed_Cdb_Item_Page::parseFromCdbXml($object);

$follower->page = $page;
$follower->user = $user;
Expand Down
11 changes: 8 additions & 3 deletions CultureFeed/CultureFeed/Pages.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,14 @@ public function getPage($id);
* Page id to query.
* @param array $roles
* Roles to filter on. (ADMIN / MEMBER / FOLLOWER)
* @return CultureFeed_ResultSet
*/
public function getUserList($id, $roles = array());
* @param bool $use_auth
* Use authentication for the request.
* @param bool $mboxIncludePrivate
* Include the user mbox (consumer needs additional permission).
*
* @return \CultureFeed_ResultSet
*/
public function getUserList($id, $roles = array(), $use_auth = TRUE, $mboxIncludePrivate = FALSE);

/**
* Add a page.
Expand Down
7 changes: 6 additions & 1 deletion CultureFeed/CultureFeed/Pages/Default.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,17 @@ public function changePermissions($id, array $params) {
/**
* @see CultureFeed_Pages::getUserList()
*/
public function getUserList($id, $roles = array(), $use_auth = TRUE) {
public function getUserList($id, $roles = array(), $use_auth = TRUE, $mboxIncludePrivate = FALSE) {

$query = array();
if (!empty($roles)) {
$query['role'] = $roles;
}

if ($mboxIncludePrivate) {
$query['mboxIncludePrivate'] = 'true';
}

if ($use_auth) {
$result = $this->oauth_client->authenticatedGetAsXml('page/' . $id . '/user/list', $query);
}
Expand All @@ -238,6 +242,7 @@ public function getUserList($id, $roles = array(), $use_auth = TRUE) {
$account->id = $object->xpath_str('user/rdf:id');
$account->nick = $object->xpath_str('user/foaf:nick');
$account->depiction = $object->xpath_str('user/foaf:depiction');
$account->mbox = $object->xpath_str('user/foaf:mbox');
$membership->user = $account;

$membership->role = $object->xpath_str('pageRole');
Expand Down
6 changes: 4 additions & 2 deletions OAuth/OAuth.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

/* Generic exception class
*/
class OAuthException extends Exception {
// pass
if (!class_exists('OAuthException')) {
class OAuthException extends Exception {
// pass
}
}

class OAuthConsumer {
Expand Down

0 comments on commit 0b323aa

Please sign in to comment.