Skip to content

Commit 7d868cd

Browse files
authored
Merge pull request #2777 from wmathurin/zero_scopes_2
Allowing no scopes to be provided
2 parents 1962712 + b1b7bc5 commit 7d868cd

8 files changed

Lines changed: 969 additions & 152 deletions

File tree

libs/SalesforceSDK/src/com/salesforce/androidsdk/accounts/UserAccount.java

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939

4040
import com.salesforce.androidsdk.app.Features;
4141
import com.salesforce.androidsdk.app.SalesforceSDKManager;
42+
import com.salesforce.androidsdk.auth.ScopeParser;
4243
import com.salesforce.androidsdk.util.MapUtil;
4344
import com.salesforce.androidsdk.util.SalesforceSDKLogger;
4445

@@ -681,38 +682,14 @@ public String getScope() {
681682
return scope;
682683
}
683684

684-
/**
685-
* Parses the space-delimited scope string into its individual components.
686-
*
687-
* @return Array of scope strings (empty if scope is null/empty).
688-
*/
689-
public String[] parseScopes() {
690-
if (TextUtils.isEmpty(scope)) {
691-
return new String[0];
692-
}
693-
final String trimmed = scope.trim();
694-
if (trimmed.isEmpty()) {
695-
return new String[0];
696-
}
697-
return trimmed.split("\\s+");
698-
}
699-
700685
/**
701686
* Checks whether the provided scope exists in this account's scope list.
702687
*
703688
* @param scopeToCheck Scope name to check.
704689
* @return True if present, false otherwise.
705690
*/
706691
public boolean hasScope(String scopeToCheck) {
707-
if (TextUtils.isEmpty(scopeToCheck)) {
708-
return false;
709-
}
710-
for (final String s : parseScopes()) {
711-
if (scopeToCheck.equals(s)) {
712-
return true;
713-
}
714-
}
715-
return false;
692+
return new ScopeParser(scope).hasScope(scopeToCheck);
716693
}
717694
/**
718695
* Returns the beacon child consumer key.

0 commit comments

Comments
 (0)