ZenDMD Tip - Add Roles to Users in a jiffy
From Zenoss Wiki
Revision as of 14:17, 20 November 2013 by Crouthamela $7
On the master, `su zenoss` then `zendmd`
usersToEdit are the usernames to add roles to.
usersToEdit = ['User1', 'User2', 'User3'] roles = ['ZenManager',] roleManager = dmd.acl_users.roleManager for user in usersToEdit: sync() un = str(user) userOb = dmd.ZenUsers.getUserSettings(str(un)) for role in roles: print 'Adding %s role from %s' % (str(role), str(userOb.id)) roleManager.assignRoleToPrincipal(str(role), str(userOb.id)) commit()