/** * Set the permissions to use when the user logs in. The permissions here should only be publish * permissions. If any read permissions are included, the login attempt by the user may 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 publish permissions to use * @throws UnsupportedOperationException if setReadPermissions has been called * @throws IllegalArgumentException if permissions is null or empty */ public void setPublishPermissions(String... permissions) { properties.setPublishPermissions(Arrays.asList(permissions)); }
/** * Set the permissions to use when the session is opened. The permissions here should only be * publish permissions. If any read permissions are included, the login attempt by the user may * 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 setReadPermissions has been called * @throws IllegalArgumentException if permissions is null or empty */ public void setPublishPermissions(List<String> permissions) { properties.setPublishPermissions(permissions, sessionTracker.getSession()); }
/** * Set the permissions to use when the user logs in. The permissions here should only be publish * permissions. If any read permissions are included, the login attempt by the user may 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 publish permissions to use * @throws UnsupportedOperationException if setReadPermissions has been called * @throws IllegalArgumentException if permissions is null or empty */ public void setPublishPermissions(List<String> permissions) { properties.setPublishPermissions(permissions); }