User role and services

How to manipulate user role and services through code like user and workspace.

Hi,
What you want to do with Users and roles.