Users

Buto has some simple rules about roles. Users has always two of this roles.

  • visitor
  • unknown
  • client

User has always role visitor. Then if user has sign in it has role client. Otherwise it has role unknown.

  PHP
  
if(wfUser::hasRole('client')){
  echo 'User has sign in!'
}
if(wfUser::hasRole('unknown')){
  echo 'User has not sign in!'
}

Extra roles

User could have other roles like for example webmaster.

  PHP
  
if(wfUser::hasRole('webmaster')){
  echo 'This content will only webmaster see because it´s in an development process.'
}

Session

In Buto params user_id and roles must be set when sign in. Parameter user_id from database user table or corresponding source. Parameter role also from db or other source. Could be an empty array also. Note that roles visitor, client and unknown is not to be set here.

  Session
  
email: me@world.se
user_id: my_user_id
role:
  - webmaster
The plugin wf/account_2 support this rules.

A plugin should store it´s own values like this.

  Session plugin param
  
email: me@world.se
user_id: my_user_id
role:
  - webmaster
plugin:
  wf:
    buto:
      role:
        - cowboy