So the addition of the permissions are all working. The users have permissions, the groups have permissions we have lots of permissions in the database.

So how do we use them? To do this we first need to get the permissions out of the database and into a format that I can quickly compare against. I am going to add the individual items into an array for further comparison later.

Now if I want to check if a user has access to something I can run the following to check for a permission

Now the locations are a little bit difficult to search for as the values are id_ before the permission group and in the event of a menu item that may cover multiple locations I dont want to have to do a look up for each location. So to accommodate this I wrote a function that will check if a string matches any of the array items and returns appropriately.

to check for access to any location timetable the command would be