// SetUserAccess sets <access> level on <target> to <subject>.
182724
func (st *State) SetUserAccess(subject names.UserTag, target names.Tag, access permission.Access) (permission.UserAccess, error) {
	err := access.Validate()
	if err != nil {
		return permission.UserAccess{}, errors.Trace(err)
	}
	switch target.Kind() {
	case names.ModelTagKind:
		err = st.setModelAccess(access, userGlobalKey(userAccessID(subject)), target.Id())
	case names.ControllerTagKind:
		err = st.setControllerAccess(access, userGlobalKey(userAccessID(subject)))
	default:
		return permission.UserAccess{}, errors.NotValidf("%q as a target", target.Kind())
	}
	if err != nil {
		return permission.UserAccess{}, errors.Trace(err)
	}
	return st.UserAccess(subject, target)
}
950714
func (s *UpdateStackInput) SetUserSettings(v []*UserSetting) *UpdateStackInput {
	s.UserSettings = v
	return s
}
615245
func (s *ListUserPoolsOutput) SetUserPools(v []*UserPoolDescriptionType) *ListUserPoolsOutput {
	s.UserPools = v
	return s
}
327008
func (sys *IAMSys) SetUserPolicy(accessKey, policyName string) error {
	objectAPI := newObjectLayerFn()
	if objectAPI == nil {
		return errServerNotInitialized
	}

	sys.Lock()
	defer sys.Unlock()

	if _, ok := sys.iamUsersMap[accessKey]; !ok {
		return errNoSuchUser
	}

	if _, ok := sys.iamCannedPolicyMap[policyName]; !ok {
		return errNoSuchPolicy
	}

	data, err := json.Marshal(policyName)
	if err != nil {
		return err
	}

	configFile := pathJoin(iamConfigUsersPrefix, accessKey, iamPolicyFile)
	if globalEtcdClient != nil {
		err = saveConfigEtcd(context.Background(), globalEtcdClient, configFile, data)
	} else {
		err = saveConfig(context.Background(), objectAPI, configFile, data)
	}
	if err != nil {
		return err
	}

	sys.iamPolicyMap[accessKey] = policyName
	return nil
}
45231
func (f *fsClient) SetAccess(access string, isJSON bool) *probe.Error {
	// For windows this feature is not implemented.
	// JSON policy for fs is not yet implemented.
	if runtime.GOOS == "windows" || isJSON {
		return probe.NewError(APINotImplemented{API: "SetAccess", APIType: "filesystem"})
	}
	st, err := f.fsStat(false)
	if err != nil {
		return err.Trace(f.PathURL.String())
	}
	if !st.Mode().IsDir() {
		return probe.NewError(APINotImplemented{API: "SetAccess", APIType: "filesystem"})
	}
	var mode os.FileMode
	switch access {
	case "readonly":
		mode = os.FileMode(0555)
	case "writeonly":
		mode = os.FileMode(0333)
	case "readwrite":
		mode = os.FileMode(0777)
	case "none":
		mode = os.FileMode(0755)
	}
	e := os.Chmod(f.PathURL.Path, mode)
	if e != nil {
		return probe.NewError(e)
	}
	return nil
}
809232
func (s *AdminDisableProviderForUserInput) SetUser(v *ProviderUserIdentifierType) *AdminDisableProviderForUserInput {
	s.User = v
	return s
}
633313
func (s *ContainerProperties) SetUser(v string) *ContainerProperties {
	s.User = &v
	return s
}
1241246
func (s *EndpointRequest) SetUser(v *EndpointUser) *EndpointRequest {
	s.User = v
	return s
}
782421
func (s *SetUserMFAPreferenceInput) SetAccessToken(v string) *SetUserMFAPreferenceInput {
	s.AccessToken = &v
	return s
}
351462
func (s *GetCurrentUserOutput) SetUser(v *User) *GetCurrentUserOutput {
	s.User = v
	return s
}
1039306
func (s *RegisterUserOutput) SetUser(v *User) *RegisterUserOutput {
	s.User = v
	return s
}
981177
func (s *VirtualMFADevice) SetUser(v *User) *VirtualMFADevice {
	s.User = v
	return s
}
123842
func (s *DirectoryDescription) SetAccessUrl(v string) *DirectoryDescription {
	s.AccessUrl = &v
	return s
}
1329276
func (s *FindingFilter) SetUserAttributes(v []*Attribute) *FindingFilter {
	s.UserAttributes = v
	return s
}
895839
func (s *GetGroupOutput) SetUsers(v []*User) *GetGroupOutput {
	s.Users = v
	return s
}
1262060
func (s *EndpointResponse) SetUser(v *EndpointUser) *EndpointResponse {
	s.User = v
	return s
}
635866
func (s *EndpointBatchItem) SetUser(v *EndpointUser) *EndpointBatchItem {
	s.User = v
	return s
}