/** * Set the permissions to use when the user logs in. The permissions here can only be read * permissions. If any publish permissions are included, the login attempt by the user will fail. * The LoginButton can only be associated with either read permissions or publish permissions, but * not both. Calling both setReadPermissions and setPublishPermissions on the same instance of * LoginButton will result in an exception being thrown unless clearPermissions is called in * between. * * <p>This method is only meaningful if called before the user logs in. If this is called after * login, and the list of permissions passed in is not a subset of the permissions granted during * the authorization, it will log an error. * * <p>It's important to always pass in a consistent set of permissions to this method, or manage * the setting of permissions outside of the LoginButton class altogether (by using the * LoginManager explicitly). * * @param permissions the read permissions to use * @throws UnsupportedOperationException if setPublishPermissions has been called */ public void setReadPermissions(String... permissions) { properties.setReadPermissions(Arrays.asList(permissions)); }
/** * Set the permissions to use when the session is opened. The permissions here can only be read * permissions. If any publish permissions are included, the login attempt by the user will fail. * The LoginButton can only be associated with either read permissions or publish permissions, but * not both. Calling both setReadPermissions and setPublishPermissions on the same instance of * LoginButton will result in an exception being thrown unless clearPermissions is called in * between. * * <p>This method is only meaningful if called before the session is open. If this is called after * the session is opened, and the list of permissions passed in is not a subset of the permissions * granted during the authorization, it will log an error. * * <p>Since the session can be automatically opened when the LoginButton is constructed, it's * important to always pass in a consistent set of permissions to this method, or manage the * setting of permissions outside of the LoginButton class altogether (by managing the session * explicitly). * * @param permissions the read permissions to use * @throws UnsupportedOperationException if setPublishPermissions has been called */ public void setReadPermissions(List<String> permissions) { properties.setReadPermissions(permissions, sessionTracker.getSession()); }
/** * Set the permissions to use when the user logs in. The permissions here can only be read * permissions. If any publish permissions are included, the login attempt by the user will fail. * The LoginButton can only be associated with either read permissions or publish permissions, but * not both. Calling both setReadPermissions and setPublishPermissions on the same instance of * LoginButton will result in an exception being thrown unless clearPermissions is called in * between. * * <p>This method is only meaningful if called before the user logs in. If this is called after * login, and the list of permissions passed in is not a subset of the permissions granted during * the authorization, it will log an error. * * <p>It's important to always pass in a consistent set of permissions to this method, or manage * the setting of permissions outside of the LoginButton class altogether (by using the * LoginManager explicitly). * * @param permissions the read permissions to use * @throws UnsupportedOperationException if setPublishPermissions has been called */ public void setReadPermissions(List<String> permissions) { properties.setReadPermissions(permissions); }