// WithNoNewPrivileges sets no_new_privileges on the process for the container
173491
func WithNoNewPrivileges(_ context.Context, _ Client, _ *containers.Container, s *Spec) error {
	setProcess(s)
	s.Process.NoNewPrivileges = true
	return nil
}
969163
func (s *ProjectEnvironment) SetPrivilegedMode(v bool) *ProjectEnvironment {
	s.PrivilegedMode = &v
	return s
}
616123
func (s *ResourceShare) SetAllowExternalPrincipals(v bool) *ResourceShare {
	s.AllowExternalPrincipals = &v
	return s
}
174276
func WithNoNewKeyring(ctx context.Context, c *Client, ti *TaskInfo) error {
	if CheckRuntime(ti.Runtime(), "io.containerd.runc") {
		if ti.Options == nil {
			ti.Options = &options.Options{}
		}
		opts, ok := ti.Options.(*options.Options)
		if !ok {
			return errors.New("invalid v2 shim create options format")
		}
		opts.NoNewKeyring = true
	} else {
		if ti.Options == nil {
			ti.Options = &runctypes.CreateOptions{}
		}
		opts, ok := ti.Options.(*runctypes.CreateOptions)
		if !ok {
			return errors.New("could not cast TaskInfo Options to CreateOptions")
		}
		opts.NoNewKeyring = true
	}
	return nil
}
26614
func (b *Builder) WithEvents(em event.EventMachine) *Builder {
	b.settings.EventMachine = em
	return b
}
647958
func (s *GrantListEntry) SetGranteePrincipal(v string) *GrantListEntry {
	s.GranteePrincipal = &v
	return s
}
805335
func (c *Compiler) WithPolicy(p *ir.Policy) *Compiler {
	c.policy = p
	return c
}
393710
func WithBlockEvents() options.Opt {
	return func(p options.Params) {
		if setter, ok := p.(permitBlockEventsSetter); ok {
			setter.PermitBlockEvents()
		}
	}
}
440267
func fixPrivileges(pgdsn, schema, schemaDsn string) error {
	parsed := parseDsn(pgdsn)
	if adminUser, ok := parsed["user"]; ok {
		db, err := sqlx.Connect(pgType, schemaDsn)
		if err != nil {
			return err
		}
		defer db.Close()
		_, err = db.Exec(fmt.Sprintf("GRANT ALL PRIVILEGES ON SCHEMA %v TO %v", schema, adminUser))
		if err != nil {
			return err
		}
	}
	return nil
}
311119
func (egta EventGridKeyAuthorizer) WithAuthorization() PrepareDecorator {
	headers := map[string]interface{}{
		"aeg-sas-key": egta.topicKey,
	}
	return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization()
}
634222
func maxPrivilege(a, b string) string {
	switch {
	case a == PolicyDeny || b == PolicyDeny:
		return PolicyDeny
	case a == PolicyWrite || b == PolicyWrite:
		return PolicyWrite
	case a == PolicyRead || b == PolicyRead:
		return PolicyRead
	default:
		return ""
	}
}
1238433
func (c *Client) WithMinIterations(n int) *Client {
	c.Lock()
	defer c.Unlock()
	c.minIters = n
	return c
}
94661
func (e *GrantExec) grantGlobalPriv(priv *ast.PrivElem, user *ast.UserSpec) error {
	if priv.Priv == 0 {
		return nil
	}
	asgns, err := composeGlobalPrivUpdate(priv.Priv, "Y")
	if err != nil {
		return err
	}
	sql := fmt.Sprintf(`UPDATE %s.%s SET %s WHERE User='%s' AND Host='%s'`, mysql.SystemDB, mysql.UserTable, asgns, user.User.Username, user.User.Hostname)
	_, _, err = e.ctx.(sqlexec.RestrictedSQLExecutor).ExecRestrictedSQL(e.ctx, sql)
	return err
}
622024
func EnableTokenPrivileges(token syscall.Token, privileges ...string) error {
	privValues, err := mapPrivileges(privileges)
	if err != nil {
		return err
	}

	var b bytes.Buffer
	binary.Write(&b, binary.LittleEndian, uint32(len(privValues)))
	for _, p := range privValues {
		binary.Write(&b, binary.LittleEndian, p)
		binary.Write(&b, binary.LittleEndian, uint32(_SE_PRIVILEGE_ENABLED))
	}

	success, err := _AdjustTokenPrivileges(token, false, &b.Bytes()[0], uint32(b.Len()), nil, nil)
	if !success {
		return err
	}
	if err == ERROR_NOT_ALL_ASSIGNED {
		return errors.Wrap(err, "error not all privileges were assigned")
	}

	return nil
}
695688
func BindPrivilegeManager(ctx sessionctx.Context, pc Manager) {
	ctx.SetValue(key, pc)
}
887975
func (client *Client) RevokeAccountPrivilege(args *RevokeAccountPrivilegeArgs) error {
	response := common.Response{}
	return client.Invoke("RevokeAccountPrivilege", args, &response)
}
124462
func (s *ShowTagKeysStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
	return ExecutionPrivileges{{Admin: false, Name: s.Database, Privilege: ReadPrivilege}}, nil
}