Restrict sources from certain users

Notes on our latest calendar for FileMaker 13,: DayBack
Posts: 5
Joined: Wed Jul 04, 2018 10:55 pm
PostPosted: Fri Nov 02, 2018 1:44 am
Hi,

A client of ours has a DayBack calendar with 4 sources in it. One of these sources holds sensitive details regarding employees sick days. I would like to only load this source for users that have the necessary privileges (for example Management).

Is there a way of doing this? I tried adding IF clauses to the sources based on user privileges in the Load Source Settings at Startup --- Describe Your Sources Here --- script but this resulted in an FMP URL error and the calendar failed to load completely. :roll:

Thanks in advance

Andy
SeedCode Staff
SeedCode Staff
Posts: 186
Joined: Tue Sep 22, 2015 2:27 pm
PostPosted: Fri Nov 02, 2018 5:30 am
Hi Andy,

Thanks for reaching out. Yes, this is definitely doable, and there are a few ways you can tackle it. First, you could hide the source's *events* for some users using hard-coded filters or FileMaker built-in access privileges as described here: OnlySeeMyEvents. However, the source name itself would still appear in the sidebar Calendars tab.

If you want to hide the source name in the Calendars tab altogether (and assuming you don't want to remove access to the Calendars tab for these users), you can do so as long as your sick days source is set up as source 4. DayBack loads sources in consecutive numerical order, and the calendar won't load if the sources defined in script don't line up with the Source No layouts. Use FileMaker access privileges to prevent access to the Source No 4 layout. Then, wrap your IF around the Source 4 section of the "Load Sources at Startup..." script with this rule:

Code: Select all
not IsEmpty ( FilterValues ( LayoutNames ( "" ) ; "Source No 4" ) )


If there are groups of users that require access to a mix of sources (like some users should only have sources 1 and 2 while others only 3 and 4), then you could hide DayBack's built-in sidebar and add your own custom sidebar where you can control the sources that appear.

Let me know if this helps!
Posts: 5
Joined: Wed Jul 04, 2018 10:55 pm
PostPosted: Mon Nov 12, 2018 1:20 am
Hi Dan,

Thanks for getting back to me. I am still having the same issues unfortunately with the FMP URL.

Here is the IF statement I have in place enclosing the Source No 4 script steps in the Load Source Settings at Startup --- Describe Your Sources Here --- script. Note that the other sources have the same if clauses too.

Code: Select all
IF[PatternCount ( privileges_HOME::zzg_privilege ; "calendar_sick" ) = 1]


This works in that if the user isn't permitted to view the sick calendar (the checkbox in the master file is not checked) then the script skips the loading of Source no 4. However, this throws up the FMP URL error.

Is there documentation on the creation of the custom sidebar you mentioned?

Thanks
Andy
SeedCode Staff
SeedCode Staff
Posts: 275
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Mon Nov 12, 2018 11:02 am
Hi Andy,

It sounds like you may have created a new Privilege Set for this group. By default, the fmurlscript extended privilege is not assigned to new Privilege Sets, so make sure you go back in there and add this extended privilege to the new set. After that, you should no longer receive the FMP URL error when opening the calendar with that user.

If that's not the case, there may be another error that is causing the calendar not to load correctly (which then causes the FMP URL error to show). If you'd like to completely hide the sick calendar from loading or showing in the sidebar, you just need to prevent access to it's related Source No layout (Source No 4) using the Privilege Set assigned to those users. Then, the if statement that Dan mentioned (which is already in most recent builds of DayBack) will automatically skip the script if the layout cannot be accessed.

If you leave the "Source No 4" layout available, but just skip that section of the "Load Source Settings ..." script, you'll see an error thrown since the number of layouts doesn't match the number of sources loaded.

Here are a couple of custom sidebars created by our customers: https://www.seedcode.com/beautiful-cust ... -calendar/
https://www.seedcode.com/custom-sidebar-for-dayback/

It's really just FileMaker objects placed to the left of the WebViewer on the calendar layout. You'll then need to set up the buttons in your custom sidebar to navigate and filter the calendar according to our docs here: https://www.seedcode.com/pmwiki/index.p ... er.Filters
https://www.seedcode.com/pmwiki/index.p ... Navigation

If you find that you're still stuck at this point, another idea would be for you to purchase an implementation package, so we can do some screen-sharing with you, or have you send over the files so we can finish the implementation for you. Packages can be used for consulting, coaching, or modifications like these and start at blocks of 3 hrs for $190/hr. When the time comes, you can use this link and, with a day or two notice, we can schedule some time to work with you:

http://sites.fastspring.com/seedcode/pr ... onpackages

Let me know if that helps!

KC
Posts: 5
Joined: Wed Jul 04, 2018 10:55 pm
PostPosted: Tue Nov 13, 2018 7:27 am
Hi KC,

Thanks for your response, it was really helpful.

We have now managed to restrict the 'Sick' calendar (Source No 4) to specific users only. However, this has now given us a new problem. For users that are setup to be able to see the 'Sick' calendar, they are only able to do so when they are assigned to the '[Full Access]' privilege set. If they are assigned to the '[Data Entry Only]' privilege set (all users are assigned to this group), the events do not show (all filters are cleared and the sick calendar is selected and active).

When debugging the script, we can see that the .txt file is exported during the Export Data to Temp Directory script but can't see a difference in behaviour when run as the same user in either privilege set but can only see events from this source when the user is set to [Full Access].

Is this something you have come across before as I can't seem to find any documentation on it or any posts in this forum.

I hope this makes sense :lol:

Thanks in advance
Andy
SeedCode Staff
SeedCode Staff
Posts: 275
Joined: Tue Nov 08, 2016 1:54 pm
PostPosted: Tue Nov 13, 2018 11:22 am
Hi Andy,

Since the "Data Entry Only" privilege set has access to all the layouts by default, you won't be able to hide the "Sick" calendar from loading, as you need to remove access to the source layout (Source No 4) to prevent it from loading on the calendar.

You'll need to duplicate the "Data Entry Only" privilege set and disable access to the Source No 4 layout in that privilege set. Then, when users load the calendar in that new privilege set, that source will not be loaded.

You'll also want to update the "$$sc_SourcesActive" variable, near line 134 in the "Load Calendar Settings - On Startup..." script, if you want to specify different default active sources per privilege set.

Let me know if that helps!

KC

Return to DayBack Calendar for FileMaker

Who is online

Users browsing this forum: No registered users and 1 guest

cron
(855) SEEDCODE
support@seedcode.com
Follow us: