Added function for applying a mode to a set of permissions. This is likely incomplete, but based on the tests should be suitable for basic usage.