For up-to-date product documentation, see the IBM MobileFirst Foundation Developer Center.
Set user permissions
We can set user permissions on remote databases.
Procedure
Set user permissions on the remote store.
BEFORE (with IMFData/CloudantToolkit):
// Get reference to data manager IMFDataManager *manager = [IMFDataManager sharedInstance]; // Set permissions for current user on a store [manager setCurrentUserPermissions: DB_ACCESS_GROUP_MEMBERS forStoreName: @"automobiledb" completionHander:^(BOOL success, NSError *error) { if(error){ // Handle error }else{ // setting permissions was successful } }];
// Get reference to data manager let manager = IMFDataManager.sharedInstance() // Set permissions for current user on a store manager.setCurrentUserPermissions(DB_ACCESS_GROUP_MEMBERS, forStoreName: "automobiledb") { (success:Bool, error:NSError!) -> Void in if nil != error { // Handle error } else { // setting permissions was successful } }
Task<Boolean> permissionsTask = manager.setCurrentUserPermissions(DataManager.DB_ACCESS_GROUP_MEMBERS, "automobiledb"); permissionsTask.continueWith(new Continuation<Boolean, Object>() { @Override public Object then(Task<Boolean> task) throws Exception { if(task.isFaulted()){ // Handle error }else{ // setting permissions was successful } return null; } });
AFTER (with Cloudant® Sync): There is no longer a way to set user permissions from the mobile device. You must set permissions with the Cloudant dashboard or server-side code. For a sample of how to integrate Mobile Client Access OAuth tokens with Cloudant Security, see the Bluelist sample.
AFTER (with Cloudant Sync): We cannot set user permissions from the mobile device. You must set permissions with the Cloudant dashboard or server-side code. For a sample of how to integrate MobileFirst OAuth tokens with Cloudant Security, see the Bluelist sample.
Parent topic: Migrating apps storing mobile data in Cloudant with IMFData or Cloudant SDK