/** * Get User Retrieve a single user, by ID or email, or the currently authenticated user. * * @return the requested User object */ public ISFQuery<SFUser> get() { SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setHttpMethod("GET"); return sfApiQuery; }
/** * Get Current User Info * * @return UserInfo */ public ISFQuery<SFUserInfo> getInfo() { SFApiQuery<SFUserInfo> sfApiQuery = new SFApiQuery<SFUserInfo>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("Info"); sfApiQuery.setHttpMethod("GET"); return sfApiQuery; }
/** * Create a one-time use login Uri for the Web App. * * @return Redirection populated with link in Uri field */ public ISFQuery<SFRedirection> webAppLink() { SFApiQuery<SFRedirection> sfApiQuery = new SFApiQuery<SFRedirection>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("WebAppLink"); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Create Employee { "Email":"*****@*****.**", "FirstName":"Name", "LastName":"Last Name", * "Company":"Company", "Password":"******", "StorageQuotaLimitGB":50, "Preferences": { * "CanResetPassword":true, "CanViewMySettings":true }, "DefaultZone": { "Id":"zoneid" }, * "IsAdministrator": false, "CanCreateFolders": false, "CanUseFileBox": true, "CanManageUsers": * false, "Roles": [ "CanChangePassword", "CanManageMySettings", "CanUseFileBox, "CanManageUsers, * "CanCreateFolders, "CanUseDropBox, "CanSelectFolderZone, "AdminAccountPolicies", * "AdminBilling", "AdminBranding", "AdminChangePlan", "AdminFileBoxAccess", * "AdminManageEmployees", "AdminRemoteUploadForms", "AdminReporting", "AdminSharedDistGroups", * "AdminSharedAddressBook", "AdminViewReceipts", "AdminDelegate", "AdminManageFolderTemplates", * "AdminEmailMessages", "AdminSSO", "AdminSuperGroup", "AdminZones", "AdminCreateSharedGroups", * "AdminConnectors" ] } Creates a new Employee User (AccountUser) and associates it to an Account * The following parameters from the input object are used: Email, FirstName, LastName, Company, * DefaultZone, Password, IsEmployee, IsAdministrator, CanCreateFolders, CanUseFileBox, * CanManageUsers, Preferences.CanResetPassword and Preferences.CanViewMySettings. Other * parameters are ignoredStorageQuotaLimitGB parameter is optional. If not specified or equal to * -1 the account default storage quota value will be set for the User. * * @param user * @param pushCreatorDefaultSettings (default: false) * @param addshared (default: false) * @param notify (default: false) * @param ifNecessary (default: false) * @return The new employee user */ public ISFQuery<SFUser> createAccountUser( SFAccountUser user, Boolean pushCreatorDefaultSettings, Boolean addshared, Boolean notify, Boolean ifNecessary) throws InvalidOrMissingParameterException { if (user == null) { throw new InvalidOrMissingParameterException("user"); } if (pushCreatorDefaultSettings == null) { throw new InvalidOrMissingParameterException("pushCreatorDefaultSettings"); } if (addshared == null) { throw new InvalidOrMissingParameterException("addshared"); } if (notify == null) { throw new InvalidOrMissingParameterException("notify"); } if (ifNecessary == null) { throw new InvalidOrMissingParameterException("ifNecessary"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("AccountUser"); sfApiQuery.addQueryString("pushCreatorDefaultSettings", pushCreatorDefaultSettings); sfApiQuery.addQueryString("addshared", addshared); sfApiQuery.addQueryString("notify", notify); sfApiQuery.addQueryString("ifNecessary", ifNecessary); sfApiQuery.setBody(user); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Create Client User { "Email":"*****@*****.**", "FirstName":"Name", "LastName":"Last Name", * "Company":"Company", "Password":"******", "Preferences": { "CanResetPassword":true, * "CanViewMySettings":true }, "DefaultZone": { "Id":"zoneid" } } Creates a new Client User and * associates it to an Account The following parameters from the input object are used: Email, * FirstName, LastName, Company, DefaultZone, Password, Preferences.CanResetPassword and * Preferences.CanViewMySettingsOther parameters are ignored * * @param user * @return The new user */ public ISFQuery<SFUser> create(SFUser user) throws InvalidOrMissingParameterException { if (user == null) { throw new InvalidOrMissingParameterException("user"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setBody(user); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Get User Retrieve a single user, by ID or email, or the currently authenticated user. * * @param id (default: null) * @return the requested User object */ public ISFQuery<SFUser> get(String id) throws InvalidOrMissingParameterException { if (id == null) { throw new InvalidOrMissingParameterException("id"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.addQueryString("id", id); sfApiQuery.setHttpMethod("GET"); return sfApiQuery; }
/** * Delete User Removes an user * * @param url */ public ISFQuery delete(URI url) throws InvalidOrMissingParameterException { if (url == null) { throw new InvalidOrMissingParameterException("url"); } SFApiQuery sfApiQuery = new SFApiQuery(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.addIds(url); sfApiQuery.setHttpMethod("DELETE"); return sfApiQuery; }
/** * Send Welcome Email Resends the 'welcome' email to the given user * * @param url */ public ISFQuery resendWelcome(URI url) throws InvalidOrMissingParameterException { if (url == null) { throw new InvalidOrMissingParameterException("url"); } SFApiQuery sfApiQuery = new SFApiQuery(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("ResendWelcome"); sfApiQuery.addIds(url); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Set email address as the primary email address for CURRENT user * * @param email * @return User */ public ISFQuery<SFUser> makePrimary(String email) throws InvalidOrMissingParameterException { if (email == null) { throw new InvalidOrMissingParameterException("email"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("MakePrimary"); sfApiQuery.addQueryString("email", email); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Forgot Password Triggers a reset password email * * @param email */ public ISFQuery forgotPassword(String email) throws InvalidOrMissingParameterException { if (email == null) { throw new InvalidOrMissingParameterException("email"); } SFApiQuery sfApiQuery = new SFApiQuery(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("ForgotPassword"); sfApiQuery.addQueryString("email", email); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Get User Security Retrieve the user security record - current state of the user regarding * security and password settings. * * @param url * @return the user security status */ public ISFQuery<SFUserSecurity> getSecurity(URI url) throws InvalidOrMissingParameterException { if (url == null) { throw new InvalidOrMissingParameterException("url"); } SFApiQuery<SFUserSecurity> sfApiQuery = new SFApiQuery<SFUserSecurity>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("Security"); sfApiQuery.addIds(url); sfApiQuery.setHttpMethod("GET"); return sfApiQuery; }
/** * Get User's FileBox folder * * @param url * @return User's FileBox */ public ISFQuery<SFItem> fileBox(URI url) throws InvalidOrMissingParameterException { if (url == null) { throw new InvalidOrMissingParameterException("url"); } SFApiQuery<SFItem> sfApiQuery = new SFApiQuery<SFItem>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("FileBox"); sfApiQuery.addIds(url); sfApiQuery.setHttpMethod("GET"); return sfApiQuery; }
/** * Confirm the current user logging in for the first time { "FirstName":"", "LastName":"", * "Company":"", "Password":"", "SecurityQuestion":"", "SecurityQuestionAnswer":"", * "DayLightName":"", "UTCOffset":"", "DateFormat":"", "TimeFormat":"", "EmailInterval":0 } * * @param settings * @return no data on success */ public ISFQuery confirm(SFUserConfirmationSettings settings) throws InvalidOrMissingParameterException { if (settings == null) { throw new InvalidOrMissingParameterException("settings"); } SFApiQuery sfApiQuery = new SFApiQuery(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("Confirm"); sfApiQuery.setBody(settings); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Update User { "FirstName":"FirstName", "LastName":"LastName", "Company":"Company", * "Email":"*****@*****.**", "Security": { "IsDisabled":false } "DefaultZone": { "Id":"newzoneid" * } } Modifies an existing user object The following parameters can be modified through this * call: FirstName, LastName, Company, Email, IsDisabled, DefaultZone Id * * @param url * @param user * @return a modified user record */ public ISFQuery<SFUser> update(URI url, SFUser user) throws InvalidOrMissingParameterException { if (url == null) { throw new InvalidOrMissingParameterException("url"); } if (user == null) { throw new InvalidOrMissingParameterException("user"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.addIds(url); sfApiQuery.setBody(user); sfApiQuery.setHttpMethod("PATCH"); return sfApiQuery; }
/** * Create Client User { "Email":"*****@*****.**", "FirstName":"Name", "LastName":"Last Name", * "Company":"Company", "Password":"******", "Preferences": { "CanResetPassword":true, * "CanViewMySettings":true }, "DefaultZone": { "Id":"zoneid" } } Creates a new Client User and * associates it to an Account The following parameters from the input object are used: Email, * FirstName, LastName, Company, DefaultZone, Password, Preferences.CanResetPassword and * Preferences.CanViewMySettingsOther parameters are ignored * * @param user * @param pushCreatorDefaultSettings (default: false) * @return The new user */ public ISFQuery<SFUser> create(SFUser user, Boolean pushCreatorDefaultSettings) throws InvalidOrMissingParameterException { if (user == null) { throw new InvalidOrMissingParameterException("user"); } if (pushCreatorDefaultSettings == null) { throw new InvalidOrMissingParameterException("pushCreatorDefaultSettings"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.addQueryString("pushCreatorDefaultSettings", pushCreatorDefaultSettings); sfApiQuery.setBody(user); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Reset Password { "NewPassword":"******", "OldPassword":"******" } { * "NewPassword":"******", "OldPassword":"******" } Resets a user password. A user can * reset his own password providing the old and new passwords. Administrators can issue this call * without providing the old password. * * @param url * @param properties * @return The modified user record */ public ISFQuery<SFUser> resetPassword(URI url, SFODataObject properties) throws InvalidOrMissingParameterException { if (url == null) { throw new InvalidOrMissingParameterException("url"); } if (properties == null) { throw new InvalidOrMissingParameterException("properties"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("ResetPassword"); sfApiQuery.addIds(url); sfApiQuery.setBody(properties); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Update User Preferences { "EnableFlashUpload":"true", "EnableJavaUpload":"true" . . . } * * @param parentUrl * @param preferences */ public ISFQuery<SFUserPreferences> updatePreferences(URI parentUrl, SFUserPreferences preferences) throws InvalidOrMissingParameterException { if (parentUrl == null) { throw new InvalidOrMissingParameterException("parentUrl"); } if (preferences == null) { throw new InvalidOrMissingParameterException("preferences"); } SFApiQuery<SFUserPreferences> sfApiQuery = new SFApiQuery<SFUserPreferences>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("Preferences"); sfApiQuery.addIds(parentUrl); sfApiQuery.setBody(preferences); sfApiQuery.setHttpMethod("PATCH"); return sfApiQuery; }
/** * Update Employee or Promote Customer { "FirstName":"FirstName", "LastName":"LastName", * "Company":"Company", "Email":"*****@*****.**", "StorageQuotaLimitGB":100, "Security": { * "IsDisabled":false } "DefaultZone": { "Id":"newzoneid" } } Modifies an existing user object The * following parameters can be modified through this call: FirstName, LastName, Company, Email, * IsEmployee, IsDisabled, DefaultZone Id, StorageQuotaLimitGB.During a promotion (the user id * points to Customer), the following parameters can be modified: CanCreateFolders, CanUseFileBox, * CanManageUsers. StorageQuotaLimitGB equal to -1 sets the user quota to the account default * storage quota value. * * @param id * @param user * @return a modified user record */ public ISFQuery<SFUser> updateAccountUser(String id, SFAccountUser user) throws InvalidOrMissingParameterException { if (id == null) { throw new InvalidOrMissingParameterException("id"); } if (user == null) { throw new InvalidOrMissingParameterException("user"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("AccountUser"); sfApiQuery.addActionIds(id); sfApiQuery.setBody(user); sfApiQuery.setHttpMethod("PATCH"); return sfApiQuery; }
/** * Remove Roles { [ "CanManageUsers", "CanSelectFolderZone" ] } Removes the roles for user. The * following roles can be removed from user through this call (depending on User type): * CanCreateFolders, CanSelectFolderZone, CanUseFileBox, CanManageUsers, AdminSharedAddressBook, * CanChangePassword, CanManageMySettings * * @param userUrl * @param userRoles */ public ISFQuery removeRoles(URI userUrl, ArrayList<SFSafeEnum<SFUserRole>> userRoles) throws InvalidOrMissingParameterException { if (userUrl == null) { throw new InvalidOrMissingParameterException("userUrl"); } if (userRoles == null) { throw new InvalidOrMissingParameterException("userRoles"); } SFApiQuery sfApiQuery = new SFApiQuery(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("RemoveRoles"); sfApiQuery.addIds(userUrl); sfApiQuery.setBody(userRoles); sfApiQuery.setHttpMethod("POST"); return sfApiQuery; }
/** * Set Roles { "Roles" : [ "CanManageUsers", "CanSelectFolderZone" ] } Sets the roles for a user * (roles not provided will be disabled.) The following roles can be set to the user through this * call (depending on User type): CanCreateFolders, CanSelectFolderZone, CanUseFileBox, * CanManageUsers, AdminSharedAddressBook, CanChangePassword, CanManageMySettings * * @param parentUrl * @param user * @return a modified user record */ public ISFQuery<SFUser> patchRoles(URI parentUrl, SFUser user) throws InvalidOrMissingParameterException { if (parentUrl == null) { throw new InvalidOrMissingParameterException("parentUrl"); } if (user == null) { throw new InvalidOrMissingParameterException("user"); } SFApiQuery<SFUser> sfApiQuery = new SFApiQuery<SFUser>(this.client); sfApiQuery.setFrom("Users"); sfApiQuery.setAction("Roles"); sfApiQuery.addIds(parentUrl); sfApiQuery.setBody(user); sfApiQuery.setHttpMethod("PUT"); return sfApiQuery; }