def add_role(self, groups=None, role_type=RoleTypes.admin):
if not groups:<EOL><INDENT>raise ArgumentError("<STR_LIT>")<EOL><DEDENT>if role_type in RoleTypes.__members__:<EOL><INDENT>role_type = RoleTypes[role_type]<EOL><DEDENT>if role_type not in RoleTypes:<EOL><INDENT>raise ArgumentError("<STR_LIT>")<EOL><DEDENT>glist = {role_type.name: [group for group in groups]}<EOL>return self.append(addRoles=glist)<EOL>
Make user have a role (typically PLC admin) with respect to some PLC groups.
:param groups: list of group names the user should have this role for
:param role_type: the role (defaults to "admin")
:return: the User, so you can do User(...).add_role(...).add_to_groups(...)