What is DAVE?

DAVE is simply an abbreviation of the followings:

  • Delete – Whether User(s) can delete content and other delete functionalities
  • Add – Whether User(s) can add content and other add/create functionalities
  • View – Whether User(s) can view contents on a page or parts of a page. (acts as read only however sometimes some contents should be visible to a user only)
  • Edit – Whether User(s) can edit contents displayed

How to use it?

Think of DAVE as a role or capability that checks whether user(s) can carry a given action. Using this method you can easily assign a user what they can see, what they can edit etc…

This is useful if you have a website where you may have different groups of users such as authors  (whom can add, edit and/or view an article but you may not want to allow them to  delete an article)

Reports for example should be only visible to an admin or a researcher you wouldn’t want it to be shown to every user.

This strategy can work also by grouping users, however when this functionality is built you should provide priorities as you will need to merge the two (group and member specific capabilities).

As you may have guessed if an admin decided a certain user should belong on a group however that user may need a few extra capabilities but you don’t want to move the user to a higher level to see irrelevant capabilities that the user will never or perhaps should never have access to that area.

With that in mind the default capabilities should be that of a group unless a user (specific) capabilities have been omitted/setup which then takes higher priority and overrides the capabilities a group has to offer if they are turned on/off.

So in other words should a user’s capabilities have been changed and if a user capability was not found it will fall-back to the groups capabilities.

A basic example

So on PHP you would do something like this…

 

 
You may also use that function like