// Assign a permission to the role.
359062
func (role *StdRole) Assign(p Permission) error {
	role.Lock()
	role.permissions[p.ID()] = p
	role.Unlock()
	return nil
}
496816
func (s *UpdateRoleDescriptionOutput) SetRole(v *Role) *UpdateRoleDescriptionOutput {
	s.Role = v
	return s
}
304236
func (ap *AccountPermissions) RemoveRole(role string) bool {
	role = string(binary.RightPadBytes([]byte(role), 32))
	for i, r := range ap.Roles {
		if r == role {
			post := []string{}
			if len(ap.Roles) > i+1 {
				post = ap.Roles[i+1:]
			}
			ap.Roles = append(ap.Roles[:i], post...)
			return true
		}
	}
	return false
}
970326
func (s *DescribedUser) SetRole(v string) *DescribedUser {
	s.Role = &v
	return s
}
741860
func (rs *RoleService) Update(ctx context.Context, roleName string, role *Role) (
	r *Role, resp *APIResponse, err error) {

	r = &Role{}
	_, resp, err = rs.client.putAction(ctx, &APIClientRequest{
		APIVersion:   apiV1,
		Path:         fmt.Sprintf("admin/security/roles/%s", roleName),
		ResponseBody: r,
		RequestBody:  role,
	})

	return
}
422616
func (s *RoleService) NewCreateRolePermissionParams(permission string, roleid string, rule string) *CreateRolePermissionParams {
	p := &CreateRolePermissionParams{}
	p.p = make(map[string]interface{})
	p.p["permission"] = permission
	p.p["roleid"] = roleid
	p.p["rule"] = rule
	return p
}
1000947
func (r User_Customer_OpenIdConnect) AddRole(role *datatypes.User_Permission_Role) (err error) {
	var resp datatypes.Void
	params := []interface{}{
		role,
	}
	err = r.Session.DoRequest("SoftLayer_User_Customer_OpenIdConnect", "addRole", params, &r.Options, &resp)
	return
}
213398
func (res *Resource) HasPermission(mode roles.PermissionMode, context *qor.Context) bool {
	if res == nil || res.Permission == nil {
		return true
	}

	var roles = []interface{}{}
	for _, role := range context.Roles {
		roles = append(roles, role)
	}
	return res.Permission.HasPermission(mode, roles...)
}
1051451
func (u *UserV2) AddRole(name string) {
	for _, r := range u.Spec.Roles {
		if r == name {
			return
		}
	}
	u.Spec.Roles = append(u.Spec.Roles, name)
}
1360033
func Convert_v1_Role_To_authorization_Role(in *v1.Role, out *authorization.Role, s conversion.Scope) error {
	return autoConvert_v1_Role_To_authorization_Role(in, out, s)
}
834840
func (s *UpdateUserInput) SetRole(v string) *UpdateUserInput {
	s.Role = &v
	return s
}
893018
func (db *Database) AddRole(role string, isAdmin bool) error {
	sec, err := db.GetSecurity()
	if err != nil {
		return err
	}
	roles := func() *[]string {
		if isAdmin {
			return &sec.Admins.Roles
		} else {
			return &sec.Members.Roles
		}
	}
	//Make sure the role isn't already there (couchdb will let you add it twice :/ )
	for _, r := range *roles() {
		if r == role {
			//already there, just return
			return nil
		}
	}
	rolesarr := roles()
	*rolesarr = append(*rolesarr, role)
	return db.SaveSecurity(*sec)
}
1037301
func (s *User) SetRole(v string) *User {
	s.Role = &v
	return s
}
1158621
func (r *SdkRoleManager) Verify(ctx context.Context, roles []string, fullmethod string) error {

	// Check all roles
	for _, role := range roles {
		// Get the role rules
		resp, err := r.Inspect(ctx, &api.SdkRoleInspectRequest{
			Name: role,
		})
		if err != nil || resp == nil || resp.GetRole() == nil {
			continue
		}

		if err := r.verifyRules(resp.GetRole().GetRules(), fullmethod); err == nil {
			return nil
		}
	}

	return status.Errorf(codes.PermissionDenied, "Access denied to roles: %+s", roles)
}
547010
func (s *FunctionConfiguration) SetRole(v string) *FunctionConfiguration {
	s.Role = &v
	return s
}
1316413
func (r *Role) Set(v string) error {
	val := Role(strings.Title(v))
	if err := val.Check(); err != nil {
		return trace.Wrap(err)
	}
	*r = val
	return nil
}
669707
func (s *CreateUserInput) SetRole(v string) *CreateUserInput {
	s.Role = &v
	return s
}