// SetRestrictedContext converts a user into a restricted account with a custom context
433822
func (api *Client) SetRestrictedContext(ctx context.Context, teamName, uid string, channelIds ...string) error {
	values := url.Values{
		"user":       {uid},
		"token":      {api.token},
		"set_active": {"true"},
		"_attempts":  {"1"},
		"channels":   {strings.Join(channelIds, ",")},
	}

	err := api.adminRequest(ctx, "setRestricted", teamName, values)
	if err != nil {
		return fmt.Errorf("failed to restrict account: %s", err)
	}

	return nil
}
167620
func (a *ResetPermissionsArgs) SetBrowserContextID(browserContextID target.BrowserContextID) *ResetPermissionsArgs {
	a.BrowserContextID = &browserContextID
	return a
}
63890
func (s *SendUsersMessageRequest) SetContext(v map[string]*string) *SendUsersMessageRequest {
	s.Context = v
	return s
}
848384
func (m *SchemaSource) SetContext(ctx *plan.Context) {
	m.ctx = ctx
	if m.session {
		m.rows = RowsForSession(ctx)
	}
}
231688
func (s *DistributionConfig) SetRestrictions(v *Restrictions) *DistributionConfig {
	s.Restrictions = v
	return s
}
1090339
func (s *GetDimensionValuesInput) SetContext(v string) *GetDimensionValuesInput {
	s.Context = &v
	return s
}
1362784
func (api *Client) SetRegularContext(ctx context.Context, teamName, user string) error {
	values := url.Values{
		"user":       {user},
		"token":      {api.token},
		"set_active": {"true"},
		"_attempts":  {"1"},
	}

	err := api.adminRequest(ctx, "setRegular", teamName, values)
	if err != nil {
		return fmt.Errorf("Failed to change the user (%s) to a regular user: %s", user, err)
	}

	return nil
}
215598
func (s *InvokeInput) SetClientContext(v string) *InvokeInput {
	s.ClientContext = &v
	return s
}
432700
func (s *CorsRule) SetAllowedHeaders(v []*string) *CorsRule {
	s.AllowedHeaders = v
	return s
}
363799
func NewLimitedContext(unitName string) *limitedContext {
	// TODO(fwereade): 2016-03-17 lp:1558657
	id := fmt.Sprintf("%s-%s-%d", unitName, "meter-status", rand.New(rand.NewSource(time.Now().Unix())).Int63())
	return &limitedContext{unitName: unitName, id: id}
}
182406
func OwnershipSetUsernameFromContext(ctx context.Context, srcOwnership *Ownership) *Ownership {
	// Check if the context has information about the user. If not,
	// then security is not enabled.
	if userinfo, ok := auth.NewUserInfoFromContext(ctx); ok {

		// Merge the previous acls which may have been set by the user
		var acls *Ownership_AccessControl
		if srcOwnership != nil {
			acls = srcOwnership.GetAcls()
		}

		return &Ownership{
			Owner: userinfo.Username,
			Acls:  acls,
		}
	}

	return srcOwnership
}
380016
func (s *MessageRequest) SetContext(v map[string]*string) *MessageRequest {
	s.Context = v
	return s
}
937979
func (s *CORSRule) SetAllowedHeaders(v []*string) *CORSRule {
	s.AllowedHeaders = v
	return s
}
80346
func (l *Logger) SetContext(ctx Ctx) *Logger {
	l.ctx = ctx
	return l
}
185728
func (a *GetPossibleBreakpointsArgs) SetRestrictToFunction(restrictToFunction bool) *GetPossibleBreakpointsArgs {
	a.RestrictToFunction = &restrictToFunction
	return a
}
993229
func (s *CorsRule) SetAllowedOrigins(v []*string) *CorsRule {
	s.AllowedOrigins = v
	return s
}
1039546
func (s *Workspace) SetUserVolumeEncryptionEnabled(v bool) *Workspace {
	s.UserVolumeEncryptionEnabled = &v
	return s
}