Jump to content
echocron

Sync User Accounts?

Recommended Posts

I think I know the answer but will ask anyway....

 

Is there a way to use MirrorSync to sync user accounts synchronized  the server and the various clients (hub and spoke)? Here are two scenarios I'm not sure how to handle:

 

1. User changes a password locally.

That never gets back to the server and if a new version of the solution comes out, the password is overwritten. I realize I could prohibit password changes and may do so.

 

2. User access rights are modified by the admin on the server.

How can that get back to the user without having to download a new version?

 

 

Share this post


Link to post
Share on other sites

1) MirrorSync does not do anything to change passwords on the server. However, if you wanted to get creative, you could use the $$MIRRORSYNC_USERTOKEN (see docs in the 'MirrorSync Customization' script) to pass whatever text data you want to the server-side script, which could conceivably do something in the MirrorSync Customization script to call the script step to change the password on the server. If you're interested in doing that, let me know and I'll send you the latest version I've been working on which makes it easier to do arbitrary actions like this in the customization script.

 

2) It can't; no structural changes can be sent to the user without them downloading a new copy of the file.

Share this post


Link to post
Share on other sites

may i use this old threat for my question?

the script set the staff's id as $$MIRRORSYNC_USERTOKEN  on the client iPad and during syncing this global variable is set in server script for customization the records. the staffID is a number field and unfortunatly all the records (1.2mio) will be transferd from the server to the iPad, not only the specific staff ones (25k).

does that mirrorsync_usertoken work with numbers as well or is it for text fields only?

if i'm writing the staffID (i.e. "1076") itself in the script for customization (on server) it's working but not when i try that 1076 is transfered as mirrorsync_usertoken.

what can i do to get the right number of records transfered?

Edited by ThomasK

Share this post


Link to post
Share on other sites

Hi Thomas - $$MIRRORSYNC_USERTOKEN is a text value, but you can certainly put a numeric value in there.

Simply setting the $$MIRRORSYNC_USERTOKEN doesn't do anything - your customization script will need to be modified on the hub (server) to do a search based on that value for the records that you want to sync for each user.

If you've already made those changes in your customization script, and it's not working the way you want, we can help with that, but we do bill for that as consulting time. Our hourly rate is $165. Let me know if you'd like for us to take a look.

Share this post


Link to post
Share on other sites

It sounds like User Accounts cannot be sync'd (i.e if I add a new user on the host, the only way to get that new user to the offline file is to download a new clone.)

Has this changed with v4?

Share this post


Link to post
Share on other sites

You are correct. File structure changes, such as value lists, user accounts, layout / script changes, will only be sent to the offline device when a new version is downloaded.

You can use the auto-update feature in version 4 to trigger the new version download fairly easily, in case that helps.

I can't think of a reason that you'd need new user accounts to be sent to the offline devices, presumably if a given user is able to log into their offline file, then it's irrelevant to them whether newly added users can as well (unless the newly added user is sharing the file with the other user, which is probably not a good idea for other reasons).

Share this post


Link to post
Share on other sites

Thanks for the response, Jesse.

Here's the scenario.  We have remote users in Venezuela.  Their internet connection speed is lousy, so downloading new clones takes a long time.  Once they have a new clone, new users come into play, so we need to add their User Name and Password to the host.

I was planning to add a "generic" login for the simple purpose of syncing and getting the new accounts downloaded.  Then the new user logs back in with their new account.  It's critical that they log in with their own account because there are many access restrictions built into each account.

My next option is to build a User Management section, but I didn't want to go there unless I had to.

If version 4 also updates User Accounts, then that really solves my problem.

Share this post


Link to post
Share on other sites

v4 does not specifically update user accounts. What it does is simplify the process of downloading new offline copies, which will include all programming changes made on the server, including user accounts, new fields, new layouts /scripts, etc.

Share this post


Link to post
Share on other sites

When it downloads a new offline copy, does it maintain the downloaded data set? 

I typically download an empty clone and populate the data set specific to the logged in user with the first sync.  Each subsequent sync updates THEIR specific data set.  If a new person logs in with a different user account, the data set gets refreshed with THEIR data.

Oh, and is the download performance about the same for a new copy or is it possibly faster?(I use xml)

Share this post


Link to post
Share on other sites

I assume each user will get their own offline copy. In that case, it won't matter to your existing offline users if a new account is created on the host, since they won't be logging in as that new user.

Each new user will need to get their own offline copy. Typically this is done using a download URL to get it, especially if you've made changes on the server and added a new account for that user. There isn't any solution that I can offer that would allow you to add new users to the hosted file, and then have that take effect in an offline copy without downloading that copy from the server. Doing the user management feature you're talking about, where the account creation process is scripted based on some table that you sync, sounds like a reasonable workaround.

Share this post


Link to post
Share on other sites

Users don't have their own copies - therein lies the problem.  AND, new users are added AFTER a copy has been downloaded.

I think you have addressed my problem in v4 as long as the User Accounts are downloaded along with everything else.

Can you address the performance issue of the simplified downloading a new copy in v4?  Faster? Same? Slower?

Thanks again for all your feedback.  I really appreciate it.

Share this post


Link to post
Share on other sites

It's a very, very bad idea for users to share the same copy of the database if there will be record level restrictions.

Let's say that user A has been syncing, and then user B logs in to the same offline copy with a different account with access to different records and runs a sync.

Best case scenario, your syncs will run extremely slowly, because MirrorSync will delete all of user A's records, and insert user B's records. This will reoccur each time that a different user logs in.

Worst case scenario, the syncs will delete records on FileMaker Server, because depending on how your filtering is done, it may appear to MirrorSync that user A deleted the records since they may not be visible when user B logs in and runs the sync.

You should instead have many copies of the offline file, one for each user. It's fine for all of these copies to exist on the same device / computer.

Share this post


Link to post
Share on other sites

Jesse, our client wants to distribute iPads with our solution on it, have it ask them to set up their user name and password on first login (their privileges are pretty restricted), then sync with the hosted file from then on out. If I understand your post above, we could set their account name and password in the $$MIRRORSYNC_USERTOKEN variable in the Customization script and have a script in the hosted file create the account. Is this correct?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×

Important Information

By using this site, you agree to our Terms of Use.