HAM: How To Use HAM_Utility To Consolidate Privilege Overrides

Hey all… a couple of days ago, I needed to re-visit how to use HAM’s HAM_Utility function to roll together layers of privilege overrides. I figured I’d share my findings here, as… I had almost forgotten myself. A couple of ground rules: you can only do 2 at a time, and later ones supersede earlier ones, so put the most permissive ones at the end. If you had 3 to roll together, and they went from 1-3, least to most permissive, roll together 1-2, then 2-3 sequentially.

The HAM_Utility custom function takes up to 5 inputs. Here, use “objectAssign” as the first one (this was the input I forgot), the 1st override as #2, and the 2nd override as #3. Use empty quotes for #4 and #5. It should look like this:

Say I had a User level override (just for me) and an Org level override (for my company). I the user has an override of {“canBBQ”: 1} and my company has {“canHerdCats”: 1}. Once HAM has consolidated these two, it’ll look like

{
“canBBQ”: 1,
“canHerdCats”: 1
}

I can both BBQ, and herd the cats.

And then you’re on to your HAM_Config function, where you roll together these extra privileges with those already available to the group (here, it’s usually the privs for the plan you subscribe to).