mirror of
https://github.com/owncloud/android-library.git
synced 2025-06-08 00:16:09 +00:00
commit
f53ebc09b2
@ -83,7 +83,7 @@ public class OwnCloudClientFactory {
|
|||||||
am.getUserData(account, AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
|
am.getUserData(account, AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
|
||||||
OwnCloudClient client = createOwnCloudClient(baseUri, appContext, !isSamlSso);
|
OwnCloudClient client = createOwnCloudClient(baseUri, appContext, !isSamlSso);
|
||||||
|
|
||||||
String username = account.name.substring(0, account.name.lastIndexOf('@'));
|
String username = AccountUtils.getUsernameForAccount(account);
|
||||||
if (isOauth2) {
|
if (isOauth2) {
|
||||||
String accessToken = am.blockingGetAuthToken(
|
String accessToken = am.blockingGetAuthToken(
|
||||||
account,
|
account,
|
||||||
@ -137,7 +137,7 @@ public class OwnCloudClientFactory {
|
|||||||
am.getUserData(account, AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
|
am.getUserData(account, AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
|
||||||
OwnCloudClient client = createOwnCloudClient(baseUri, appContext, !isSamlSso);
|
OwnCloudClient client = createOwnCloudClient(baseUri, appContext, !isSamlSso);
|
||||||
|
|
||||||
String username = account.name.substring(0, account.name.lastIndexOf('@'));
|
String username = AccountUtils.getUsernameForAccount(account);
|
||||||
if (isOauth2) { // TODO avoid a call to getUserData here
|
if (isOauth2) { // TODO avoid a call to getUserData here
|
||||||
AccountManagerFuture<Bundle> future = am.getAuthToken(
|
AccountManagerFuture<Bundle> future = am.getAuthToken(
|
||||||
account,
|
account,
|
||||||
|
@ -147,6 +147,22 @@ public class AccountUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the username corresponding to an OC account.
|
||||||
|
*
|
||||||
|
* @param account An OC account
|
||||||
|
* @return Username for the given account, extracted from the account.name
|
||||||
|
*/
|
||||||
|
public static String getUsernameForAccount(Account account) {
|
||||||
|
String username = null;
|
||||||
|
try {
|
||||||
|
username = account.name.substring(0, account.name.lastIndexOf('@'));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Log_OC.e(TAG, "Couldn't get a username for the given account", e);
|
||||||
|
}
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @return
|
* @return
|
||||||
@ -168,7 +184,7 @@ public class AccountUtils {
|
|||||||
account,
|
account,
|
||||||
AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
|
AccountUtils.Constants.KEY_SUPPORTS_SAML_WEB_SSO) != null;
|
||||||
|
|
||||||
String username = account.name.substring(0, account.name.lastIndexOf('@'));
|
String username = AccountUtils.getUsernameForAccount(account);
|
||||||
|
|
||||||
if (isOauth2) {
|
if (isOauth2) {
|
||||||
String accessToken = am.blockingGetAuthToken(
|
String accessToken = am.blockingGetAuthToken(
|
||||||
|
@ -217,6 +217,9 @@ public class UpdateRemoteShareOperation extends RemoteOperation {
|
|||||||
} else {
|
} else {
|
||||||
result = new RemoteOperationResult(false, status, put.getResponseHeaders());
|
result = new RemoteOperationResult(false, status, put.getResponseHeaders());
|
||||||
}
|
}
|
||||||
|
if (!result.isSuccess()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user