com.facebook.internal.SessionAuthorizationType Java Examples

The following examples show how to use com.facebook.internal.SessionAuthorizationType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FacebookFragment.java    From KlyphMessenger with MIT License 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #2
Source File: FacebookFragment.java    From barterli_android with Apache License 2.0 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #3
Source File: Session.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
 
Example #4
Source File: FacebookFragment.java    From facebook-api-android-maven with Apache License 2.0 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #5
Source File: FacebookFragment.java    From Abelana-Android with Apache License 2.0 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #6
Source File: FacebookFragment.java    From Klyph with MIT License 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #7
Source File: FacebookFragment.java    From HypFacebook with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #8
Source File: Session.java    From Klyph with MIT License 6 votes vote down vote up
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
 
Example #9
Source File: Session.java    From Klyph with MIT License 6 votes vote down vote up
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
 
Example #10
Source File: Session.java    From FacebookNewsfeedSample-Android with Apache License 2.0 6 votes vote down vote up
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            switch (this.state) {
                case OPENED:
                case OPENED_TOKEN_UPDATED:
                    pendingRequest = newPermissionsRequest;
                    break;
                default:
                    throw new UnsupportedOperationException(
                            "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        authorize(newPermissionsRequest);
    }
}
 
Example #11
Source File: FacebookFragment.java    From FacebookImageShareIntent with MIT License 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #12
Source File: FacebookFragment.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #13
Source File: Session.java    From KlyphMessenger with MIT License 6 votes vote down vote up
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingAuthorizationRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            if (state.isOpened()) {
                pendingAuthorizationRequest = newPermissionsRequest;
            } else if (state.isClosed()) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has been closed.");
            } else {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        addCallback(newPermissionsRequest.getCallback());
        authorize(newPermissionsRequest);
    }
}
 
Example #14
Source File: Session.java    From KlyphMessenger with MIT License 6 votes vote down vote up
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
 
Example #15
Source File: FacebookFragment.java    From FacebookNewsfeedSample-Android with Apache License 2.0 6 votes vote down vote up
private void openSession(String applicationId, List<String> permissions,
        SessionLoginBehavior behavior, int activityCode, SessionAuthorizationType authType) {
    if (sessionTracker != null) {
        Session currentSession = sessionTracker.getSession();
        if (currentSession == null || currentSession.getState().isClosed()) {
            Session session = new Session.Builder(getActivity()).setApplicationId(applicationId).build();
            Session.setActiveSession(session);
            currentSession = session;
        }
        if (!currentSession.isOpened()) {
            Session.OpenRequest openRequest = new Session.OpenRequest(this).
                    setPermissions(permissions).
                    setLoginBehavior(behavior).
                    setRequestCode(activityCode);
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                currentSession.openForPublish(openRequest);
            } else {
                currentSession.openForRead(openRequest);
            }
        }
    }
}
 
Example #16
Source File: Session.java    From HypFacebook with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private void validatePermissions(AuthorizationRequest request, SessionAuthorizationType authType) {
    if (request == null || Utility.isNullOrEmpty(request.getPermissions())) {
        if (SessionAuthorizationType.PUBLISH.equals(authType)) {
            throw new FacebookException("Cannot request publish or manage authorization with no permissions.");
        }
        return; // nothing to check
    }
    for (String permission : request.getPermissions()) {
        if (isPublishPermission(permission)) {
            if (SessionAuthorizationType.READ.equals(authType)) {
                throw new FacebookException(
                        String.format(
                                "Cannot pass a publish or manage permission (%s) to a request for read authorization",
                                permission));
            }
        } else {
            if (SessionAuthorizationType.PUBLISH.equals(authType)) {
                Log.w(TAG,
                        String.format(
                                "Should not pass a read permission (%s) to a request for publish or manage authorization",
                                permission));
            }
        }
    }
}
 
Example #17
Source File: Session.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 6 votes vote down vote up
private void requestNewPermissions(NewPermissionsRequest newPermissionsRequest, SessionAuthorizationType authType) {
    validatePermissions(newPermissionsRequest, authType);
    validateLoginBehavior(newPermissionsRequest);

    if (newPermissionsRequest != null) {
        synchronized (this.lock) {
            if (pendingRequest != null) {
                throw new UnsupportedOperationException(
                        "Session: an attempt was made to request new permissions for a session that has a pending request.");
            }
            switch (this.state) {
                case OPENED:
                case OPENED_TOKEN_UPDATED:
                    pendingRequest = newPermissionsRequest;
                    break;
                default:
                    throw new UnsupportedOperationException(
                            "Session: an attempt was made to request new permissions for a session that is not currently open.");
            }
        }

        newPermissionsRequest.setValidateSameFbidAsToken(getAccessToken());
        authorize(newPermissionsRequest);
    }
}
 
Example #18
Source File: LoginButton.java    From Klyph with MIT License 5 votes vote down vote up
public void setReadPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.PUBLISH.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setReadPermissions after setPublishPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.READ, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.READ;
    }
}
 
Example #19
Source File: LoginButton.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
private boolean validatePermissions(List<String> permissions,
        SessionAuthorizationType authType, Session currentSession) {
    if (SessionAuthorizationType.PUBLISH.equals(authType)) {
        if (Utility.isNullOrEmpty(permissions)) {
            throw new IllegalArgumentException("Permissions for publish actions cannot be null or empty.");
        }
    }
    if (currentSession != null && currentSession.isOpened()) {
        if (!Utility.isSubset(permissions, currentSession.getPermissions())) {
            Log.e(TAG, "Cannot set additional permissions when session is already open.");
            return false;
        }
    }
    return true;
}
 
Example #20
Source File: LoginButton.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
public void setPublishPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.READ.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setPublishPermissions after setReadPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.PUBLISH, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.PUBLISH;
    }
}
 
Example #21
Source File: LoginButton.java    From Abelana-Android with Apache License 2.0 5 votes vote down vote up
public void setReadPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.PUBLISH.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setReadPermissions after setPublishPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.READ, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.READ;
    }
}
 
Example #22
Source File: LoginButton.java    From aws-mobile-self-paced-labs-samples with Apache License 2.0 5 votes vote down vote up
private boolean validatePermissions(List<String> permissions,
        SessionAuthorizationType authType, Session currentSession) {
    if (SessionAuthorizationType.PUBLISH.equals(authType)) {
        if (Utility.isNullOrEmpty(permissions)) {
            throw new IllegalArgumentException("Permissions for publish actions cannot be null or empty.");
        }
    }
    if (currentSession != null && currentSession.isOpened()) {
        if (!Utility.isSubset(permissions, currentSession.getPermissions())) {
            Log.e(TAG, "Cannot set additional permissions when session is already open.");
            return false;
        }
    }
    return true;
}
 
Example #23
Source File: LoginButton.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
public void setPublishPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.READ.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setPublishPermissions after setReadPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.PUBLISH, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.PUBLISH;
    }
}
 
Example #24
Source File: LoginButton.java    From KlyphMessenger with MIT License 5 votes vote down vote up
public void setPublishPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.READ.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setPublishPermissions after setReadPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.PUBLISH, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.PUBLISH;
    }
}
 
Example #25
Source File: LoginButton.java    From android-skeleton-project with MIT License 5 votes vote down vote up
public void setReadPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.PUBLISH.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setReadPermissions after setPublishPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.READ, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.READ;
    }
}
 
Example #26
Source File: LoginButton.java    From android-skeleton-project with MIT License 5 votes vote down vote up
public void setPublishPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.READ.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setPublishPermissions after setReadPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.PUBLISH, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.PUBLISH;
    }
}
 
Example #27
Source File: LoginButton.java    From android-skeleton-project with MIT License 5 votes vote down vote up
private boolean validatePermissions(List<String> permissions,
        SessionAuthorizationType authType, Session currentSession) {
    if (SessionAuthorizationType.PUBLISH.equals(authType)) {
        if (Utility.isNullOrEmpty(permissions)) {
            throw new IllegalArgumentException("Permissions for publish actions cannot be null or empty.");
        }
    }
    if (currentSession != null && currentSession.isOpened()) {
        if (!Utility.isSubset(permissions, currentSession.getPermissions())) {
            Log.e(TAG, "Cannot set additional permissions when session is already open.");
            return false;
        }
    }
    return true;
}
 
Example #28
Source File: LoginButton.java    From HypFacebook with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void setReadPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.PUBLISH.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setReadPermissions after setPublishPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.READ, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.READ;
    }
}
 
Example #29
Source File: LoginButton.java    From facebook-api-android-maven with Apache License 2.0 5 votes vote down vote up
public void setPublishPermissions(List<String> permissions, Session session) {
    if (SessionAuthorizationType.READ.equals(authorizationType)) {
        throw new UnsupportedOperationException(
                "Cannot call setPublishPermissions after setReadPermissions has been called.");
    }
    if (validatePermissions(permissions, SessionAuthorizationType.PUBLISH, session)) {
        this.permissions = permissions;
        authorizationType = SessionAuthorizationType.PUBLISH;
    }
}
 
Example #30
Source File: LoginButton.java    From FacebookNewsfeedSample-Android with Apache License 2.0 5 votes vote down vote up
private boolean validatePermissions(List<String> permissions,
        SessionAuthorizationType authType, Session currentSession) {
    if (SessionAuthorizationType.PUBLISH.equals(authType)) {
        if (Utility.isNullOrEmpty(permissions)) {
            throw new IllegalArgumentException("Permissions for publish actions cannot be null or empty.");
        }
    }
    if (currentSession != null && currentSession.isOpened()) {
        if (!Utility.isSubset(permissions, currentSession.getPermissions())) {
            Log.e(TAG, "Cannot set additional permissions when session is already open.");
            return false;
        }
    }
    return true;
}