You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/02/07 21:20:59 UTC
[1/6] git commit: Added serialize method to collections
Updated Branches:
refs/pull/47/merge 819fbb7b1 -> d51e271b8 (forced update)
Added serialize method to collections
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/11917f24
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/11917f24
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/11917f24
Branch: refs/pull/47/merge
Commit: 11917f24d6d9295595c97d2414689ccecbb93fd0
Parents: 80c4ddd
Author: ryan bridges <rb...@apigee.com>
Authored: Sat Feb 1 14:50:59 2014 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Sat Feb 1 14:50:59 2014 -0500
----------------------------------------------------------------------
.../php/lib/vendor/Apigee/Usergrid/Collection.php | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/11917f24/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
----------------------------------------------------------------------
diff --git a/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php b/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
index cefa43b..9b49d38 100644
--- a/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
+++ b/sdks/php/lib/vendor/Apigee/Usergrid/Collection.php
@@ -274,5 +274,21 @@ class Collection {
}
return FALSE;
}
+ public function serialize(){
+ $data = array();
+ $data->type = $this->type;
+ $data->qs = $this->qs;
+ $data->iterator = $this->iterator;
+ $data->previous = $this->previous;
+ $data->next = $this->next;
+ $data->cursor = $this->cursor;
+ $data->list=[];
+ $this->reset_entity_pointer();
+ while ($this->has_next_entity()) {
+ $entity = $this->get_next_entity();
+ array_push($data->list, $entity->get_json())
+ }
+ return json_encode($data);
+ }
-}
\ No newline at end of file
+}
[3/6] git commit: USERGRID-77 can't login for newly created user due
to NPE
Posted by sn...@apache.org.
USERGRID-77 can't login for newly created user due to NPE
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/4829c7ab
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/4829c7ab
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/4829c7ab
Branch: refs/pull/47/merge
Commit: 4829c7abe19e60cc212a8c96b9b799cf8a3ad958
Parents: 5faeb10
Author: Strong Liu <st...@hibernate.org>
Authored: Thu Feb 6 23:58:13 2014 +0800
Committer: Strong Liu <st...@hibernate.org>
Committed: Thu Feb 6 23:58:13 2014 +0800
----------------------------------------------------------------------
.../management/AccountCreationProps.java | 7 +++
.../cassandra/AccountCreationPropsImpl.java | 50 +++++++++++++++++++-
.../cassandra/ManagementServiceImpl.java | 40 +++++-----------
3 files changed, 66 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4829c7ab/stack/services/src/main/java/org/usergrid/management/AccountCreationProps.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/AccountCreationProps.java b/stack/services/src/main/java/org/usergrid/management/AccountCreationProps.java
index a4ef4a8..6ed892b 100644
--- a/stack/services/src/main/java/org/usergrid/management/AccountCreationProps.java
+++ b/stack/services/src/main/java/org/usergrid/management/AccountCreationProps.java
@@ -116,4 +116,11 @@ public interface AccountCreationProps {
public void setProperty( String name, String value );
public Properties getMailProperties();
+ public SuperUser getSuperUser();
+ public static interface SuperUser{
+ boolean isEnabled();
+ String getUsername();
+ String getEmail();
+ String getPassword();
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4829c7ab/stack/services/src/main/java/org/usergrid/management/cassandra/AccountCreationPropsImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/cassandra/AccountCreationPropsImpl.java b/stack/services/src/main/java/org/usergrid/management/cassandra/AccountCreationPropsImpl.java
index 98e70c7..06c809a 100644
--- a/stack/services/src/main/java/org/usergrid/management/cassandra/AccountCreationPropsImpl.java
+++ b/stack/services/src/main/java/org/usergrid/management/cassandra/AccountCreationPropsImpl.java
@@ -26,16 +26,18 @@ import org.usergrid.management.AccountCreationProps;
import static java.lang.Boolean.parseBoolean;
import static org.apache.commons.lang.StringUtils.isBlank;
+import static org.usergrid.utils.ListUtils.anyNull;
public class AccountCreationPropsImpl implements AccountCreationProps {
private static final Logger logger = LoggerFactory.getLogger( AccountCreationPropsImpl.class );
- protected Properties properties;
-
+ protected final Properties properties;
+ private final SuperUser superUser;
public AccountCreationPropsImpl( Properties properties ) {
this.properties = properties;
+ this.superUser = new SuperUserImpl(properties);
}
@@ -109,4 +111,48 @@ public class AccountCreationPropsImpl implements AccountCreationProps {
}
return p;
}
+
+ @Override
+ public SuperUser getSuperUser() {
+ return superUser;
+ }
+
+ protected static class SuperUserImpl implements SuperUser {
+ private final boolean enabled;
+ private final String username;
+ private final String email;
+ private final String password;
+
+ public SuperUserImpl(Properties properties) {
+ enabled = parseBoolean(properties.getProperty(PROPERTIES_SYSADMIN_LOGIN_ALLOWED));
+ username = properties.getProperty(PROPERTIES_SYSADMIN_LOGIN_NAME);
+ email = properties.getProperty(PROPERTIES_SYSADMIN_LOGIN_EMAIL);
+ password = properties.getProperty(PROPERTIES_SYSADMIN_LOGIN_PASSWORD);
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return superuserEnabled();
+ }
+
+ @Override
+ public String getUsername() {
+ return username;
+ }
+
+ @Override
+ public String getEmail() {
+ return email;
+ }
+
+ @Override
+ public String getPassword() {
+ return password;
+ }
+
+ private boolean superuserEnabled() {
+ return enabled && !anyNull(username, email, password);
+ }
+ }
+
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/4829c7ab/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
index f7cc99c..429491b 100644
--- a/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -129,10 +129,7 @@ import static org.usergrid.management.AccountCreationProps.PROPERTIES_MAILER_EMA
import static org.usergrid.management.AccountCreationProps.PROPERTIES_ORGANIZATION_ACTIVATION_URL;
import static org.usergrid.management.AccountCreationProps.PROPERTIES_SETUP_TEST_ACCOUNT;
import static org.usergrid.management.AccountCreationProps.PROPERTIES_SYSADMIN_EMAIL;
-import static org.usergrid.management.AccountCreationProps.PROPERTIES_SYSADMIN_LOGIN_ALLOWED;
import static org.usergrid.management.AccountCreationProps.PROPERTIES_SYSADMIN_LOGIN_EMAIL;
-import static org.usergrid.management.AccountCreationProps.PROPERTIES_SYSADMIN_LOGIN_NAME;
-import static org.usergrid.management.AccountCreationProps.PROPERTIES_SYSADMIN_LOGIN_PASSWORD;
import static org.usergrid.management.AccountCreationProps.PROPERTIES_TEST_ACCOUNT_ADMIN_USER_EMAIL;
import static org.usergrid.management.AccountCreationProps.PROPERTIES_TEST_ACCOUNT_ADMIN_USER_NAME;
import static org.usergrid.management.AccountCreationProps.PROPERTIES_TEST_ACCOUNT_ADMIN_USER_PASSWORD;
@@ -321,37 +318,25 @@ public class ManagementServiceImpl implements ManagementService {
logger.warn( "Test app creation disabled" );
}
- if ( superuserEnabled() ) {
+ if ( properties.getSuperUser().isEnabled() ) {
provisionSuperuser();
}
}
- public boolean superuserEnabled() {
- boolean superuser_enabled = parseBoolean( properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_ALLOWED ) );
- String superuser_username = properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_NAME );
- String superuser_email = properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_EMAIL );
- String superuser_password = properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_PASSWORD );
-
- return superuser_enabled && !anyNull( superuser_username, superuser_email, superuser_password );
- }
@Override
public void provisionSuperuser() throws Exception {
- boolean superuser_enabled = parseBoolean( properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_ALLOWED ) );
- String superuser_username = properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_NAME );
- String superuser_email = properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_EMAIL );
- String superuser_password = properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_PASSWORD );
-
- if ( !anyNull( superuser_username, superuser_email, superuser_password ) ) {
- UserInfo user = this.getAdminUserByUsername( superuser_username );
+ final AccountCreationProps.SuperUser superUser = properties.getSuperUser();
+ if ( superUser.isEnabled() ) {
+ UserInfo user = this.getAdminUserByUsername( superUser.getUsername() );
if ( user == null ) {
- createAdminUser( superuser_username, "Super User", superuser_email, superuser_password,
- superuser_enabled, !superuser_enabled );
+ createAdminUser( superUser.getUsername(), "Super User", superUser.getEmail(), superUser.getPassword(),
+ superUser.isEnabled(), !superUser.isEnabled() );
}
else {
- this.setAdminUserPassword( user.getUuid(), superuser_password );
+ this.setAdminUserPassword( user.getUuid(), superUser.getPassword() );
}
}
else {
@@ -1246,13 +1231,12 @@ public class ManagementServiceImpl implements ManagementService {
if ( verify( MANAGEMENT_APPLICATION_ID, user.getUuid(), password ) ) {
userInfo = getUserInfo( MANAGEMENT_APPLICATION_ID, user );
- boolean userIsSuperAdmin =
- properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_EMAIL ).equals( userInfo.getEmail() );
+ boolean userIsSuperAdmin = properties.getSuperUser().isEnabled() && properties.getSuperUser().getEmail().equals(userInfo.getEmail());
boolean testUserEnabled = parseBoolean( properties.getProperty( PROPERTIES_SETUP_TEST_ACCOUNT ) );
boolean userIsTestUser = !testUserEnabled ? false :
- properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_EMAIL )
+ properties.getProperty( PROPERTIES_TEST_ACCOUNT_ADMIN_USER_EMAIL )
.equals( userInfo.getEmail() );
if ( !userIsSuperAdmin && !userIsTestUser ) {
@@ -1488,10 +1472,8 @@ public class ManagementServiceImpl implements ManagementService {
json.put( "organizations", jsonOrganizations );
Map<UUID, String> organizations;
-
- boolean superuser_enabled = parseBoolean( properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_ALLOWED ) );
- String superuser_username = properties.getProperty( PROPERTIES_SYSADMIN_LOGIN_NAME );
- if ( superuser_enabled && ( superuser_username != null ) && superuser_username.equals( user.getUsername() ) ) {
+ AccountCreationProps.SuperUser superUser = properties.getSuperUser();
+ if ( superUser.isEnabled() && superUser.getUsername().equals( user.getUsername() ) ) {
organizations = buildOrgBiMap( getOrganizations( null, 10 ) );
}
else {
[4/6] git commit: Merge pull request #45 from r3b/php-connections
Posted by sn...@apache.org.
Merge pull request #45 from r3b/php-connections
Php connections
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/2929f600
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/2929f600
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/2929f600
Branch: refs/pull/47/merge
Commit: 2929f6008f84cb215bd22fb8bd6b1547c7b294f6
Parents: 5faeb10 0f7c144
Author: Rod Simpson <ro...@rodsimpson.com>
Authored: Thu Feb 6 13:50:49 2014 -0700
Committer: Rod Simpson <ro...@rodsimpson.com>
Committed: Thu Feb 6 13:50:49 2014 -0700
----------------------------------------------------------------------
.../lib/vendor/Apigee/Usergrid/Collection.php | 18 +++-
sdks/php/lib/vendor/Apigee/Usergrid/Entity.php | 90 ++++++++++++++++++--
2 files changed, 101 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
[2/6] git commit: Added get_entity_id, connect, disconnect,
get_connections, and get_connecting to Entity
Posted by sn...@apache.org.
Added get_entity_id, connect, disconnect, get_connections, and get_connecting to Entity
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/0f7c144b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/0f7c144b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/0f7c144b
Branch: refs/pull/47/merge
Commit: 0f7c144b08b00358829f96b08aa0afc043e01197
Parents: 11917f2
Author: ryan bridges <rb...@apigee.com>
Authored: Sat Feb 1 14:52:24 2014 -0500
Committer: ryan bridges <rb...@apigee.com>
Committed: Sat Feb 1 14:52:24 2014 -0500
----------------------------------------------------------------------
sdks/php/lib/vendor/Apigee/Usergrid/Entity.php | 90 +++++++++++++++++++--
1 file changed, 84 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/0f7c144b/sdks/php/lib/vendor/Apigee/Usergrid/Entity.php
----------------------------------------------------------------------
diff --git a/sdks/php/lib/vendor/Apigee/Usergrid/Entity.php b/sdks/php/lib/vendor/Apigee/Usergrid/Entity.php
index 6dc970c..d69b1c7 100755
--- a/sdks/php/lib/vendor/Apigee/Usergrid/Entity.php
+++ b/sdks/php/lib/vendor/Apigee/Usergrid/Entity.php
@@ -200,19 +200,97 @@ class Entity {
}
public function connect($connection, $entity) {
- // TODO
+ $connectee=Entity::get_entity_id($entity);
+ $connecteeType=$entity->get("type");
+ if(!$connectee){
+ return "Error in connect. No UUID specified for connectee";
+ }
+
+ $connector=Entity::get_entity_id($this);
+ $connectorType=$this->get("type");
+ if(!$connector){
+ return "Error in connect. No UUID specified for connector";
+ }
+
+ $endpoint = $connectorType.'/'.$connector.'/'.$connection.'/'.$connecteeType.'/'.$connectee;
+ $result=$this->client->post($endpoint, array(), array());
+ $error=$result->get_error();
+ if($error){
+ return $result->get_error_message();
+ }else{
+ return $result->get_data();
+ }
+ }
+
+ public function disconnect($connection, $entity) {
+ $connectee=Entity::get_entity_id($entity);
+ $connecteeType=$entity->get("type");
+ if(!$connectee){
+ return "Error in disconnect. No UUID specified for connectee";
+ }
+
+ $connector=Entity::get_entity_id($this);
+ $connectorType=$this->get("type");
+ if(!$connector){
+ return "Error in disconnect. No UUID specified for connector";
+ }
+
+ $endpoint = $connectorType.'/'.$connector.'/'.$connection.'/'.$connecteeType.'/'.$connectee;
+
+ $result=$this->client->delete($endpoint, array(), array());
+ $error=$result->get_error();
+ if($error){
+ return $result->get_error_message();
+ }else{
+ return $result->get_data();
+ }
}
public static function get_entity_id($entity) {
- // TODO
+ $id = false;
+ if (Client::is_uuid($entity->get('uuid'))) {
+ $id = $entity->get('uuid');
+ } else {
+ if ($type == 'users') {
+ $id = $entity->get('username');
+ } else if ($entity->get('name')) {
+ $id = $entity->get('name');
+ }
+ }
+ return $id;
}
public function get_connections($connection) {
- // TODO
+ $connectorType = $this->get('type');
+ $connector = Entity::get_entity_id($this);
+ if (!$connector) {
+ return;
+ }
+
+ $endpoint = $connectorType . '/' . $connector . '/' . $connection . '/';
+ $result=$this->client->get($endpoint, array());
+ $this->set($connection,array());
+
+ $length = count($result->entities);
+ for ($i = 0; i < $length; $i++) {
+ if ($result['entities'][i]['type'] == 'user') {
+ $this[$connection][$result['entities'][i]['username']] = $result['entities'][i];
+ } else {
+ $this[$connection][$result['entities'][i]['name']] = $result['entities'][i];
+ }
+ }
}
- public function disconnect($connection, $entity) {
- // TODO
+ public function get_connecting($connection) {
+ $connectorType = $this->get('type');
+ $connector = Entity::get_entity_id($this);
+ if (!$connector) {
+ return;
+ }
+
+ $endpoint = $connectorType. '/' . $connector . '/connecting/' . $connection . '/';
+ $result=$this->client->get($endpoint, array());
+ return $result->get_data();
}
-}
\ No newline at end of file
+}
[6/6] git commit: Merge 6c14dc28f3cd79452e8d5a56f4703ce7c17eba94 into
f564f0d94f574f6e943346ed82502b080ceb0268
Posted by sn...@apache.org.
Merge 6c14dc28f3cd79452e8d5a56f4703ce7c17eba94 into f564f0d94f574f6e943346ed82502b080ceb0268
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/d51e271b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/d51e271b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/d51e271b
Branch: refs/pull/47/merge
Commit: d51e271b8dd34e19581159d5785c5b75b236dd07
Parents: f564f0d 6c14dc2
Author: Sungju Jin <su...@softwaregeeks.org>
Authored: Sat Feb 8 04:43:07 2014 +0900
Committer: Sungju Jin <su...@softwaregeeks.org>
Committed: Sat Feb 8 04:43:07 2014 +0900
----------------------------------------------------------------------
.../RepairingMismatchedApplicationMetadata.java | 57 ++++++++++++++++++++
1 file changed, 57 insertions(+)
----------------------------------------------------------------------
[5/6] git commit: Merge pull request #48 from stliu/USERGRID-77
Posted by sn...@apache.org.
Merge pull request #48 from stliu/USERGRID-77
USERGRID-77 can't login for newly created user due to NPE
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/f564f0d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f564f0d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f564f0d9
Branch: refs/pull/47/merge
Commit: f564f0d94f574f6e943346ed82502b080ceb0268
Parents: 2929f60 4829c7a
Author: Todd Nine <tn...@apigee.com>
Authored: Fri Feb 7 09:09:33 2014 -0700
Committer: Todd Nine <tn...@apigee.com>
Committed: Fri Feb 7 09:09:33 2014 -0700
----------------------------------------------------------------------
.../management/AccountCreationProps.java | 7 +++
.../cassandra/AccountCreationPropsImpl.java | 50 +++++++++++++++++++-
.../cassandra/ManagementServiceImpl.java | 40 +++++-----------
3 files changed, 66 insertions(+), 31 deletions(-)
----------------------------------------------------------------------