// GrantPrivileges grant privileges to a user-defined role.
556681
func (clnt *Client) GrantPrivileges(policy *AdminPolicy, roleName string, privileges []Privilege) error {
	policy = clnt.getUsableAdminPolicy(policy)

	command := newAdminCommand(nil)
	return command.grantPrivileges(clnt.cluster, policy, roleName, privileges)
}
118592
func (clnt *Client) GrantRoles(policy *AdminPolicy, user string, roles []string) error {
	policy = clnt.getUsableAdminPolicy(policy)

	command := newAdminCommand(nil)
	return command.grantRoles(clnt.cluster, policy, user, roles)
}
426096
func (svc *S3Accessor) BucketPrivilege(bucketPrivs ...string) sparta.IAMRolePrivilege {
	return sparta.IAMRolePrivilege{
		Actions:  bucketPrivs,
		Resource: spartaCF.S3ArnForBucket(gocf.Ref(svc.S3BucketResourceName)),
	}
}
1261995
func HasTypePrivilege(db XODB, v0 string, v1 string, v2 pgtypes.Oid, v3 string, v4 pgtypes.Name, v5 string, v6 string, v7 pgtypes.Name, v8 pgtypes.Oid, v9 string, v10 pgtypes.Oid, v11 string, v12 string, v13 pgtypes.Oid, v14 pgtypes.Oid, v15 string) (bool, error) {
	var err error

	// sql query
	const sqlstr = `SELECT pg_catalog.has_type_privilege($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16)`

	// run query
	var ret bool
	XOLog(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15)
	err = db.QueryRow(sqlstr, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15).Scan(&ret)
	if err != nil {
		return false, err
	}

	return ret, nil
}
1296484
func (s *GenerateDataKeyWithoutPlaintextInput) SetGrantTokens(v []*string) *GenerateDataKeyWithoutPlaintextInput {
	s.GrantTokens = v
	return s
}
946089
func (s *ShowMeasurementCardinalityStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
	if !s.Exact {
		return ExecutionPrivileges{{Admin: false, Name: s.Database, Privilege: ReadPrivilege}}, nil
	}
	return s.Sources.RequiredPrivileges()
}
855955
func (mh *MethodHandler) Privileges(privileges ...sparta.IAMRolePrivilege) *MethodHandler {
	if mh.privileges == nil {
		mh.privileges = make([]sparta.IAMRolePrivilege, 0)
	}
	mh.privileges = append(mh.privileges, privileges...)
	return mh
}
242507
func hasPrivilegedContainers(tmpl *wfv1.Template) bool {
	if containerIsPrivileged(tmpl.Container) {
		return true
	}
	for _, side := range tmpl.Sidecars {
		if containerIsPrivileged(&side.Container) {
			return true
		}
	}
	return false
}
1221248
func (s *ShowDatabasesStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
	// SHOW DATABASES is one of few statements that have no required privileges.
	// Anyone is allowed to execute it, but the returned results depend on the user's
	// individual database permissions.
	return ExecutionPrivileges{{Admin: false, Name: "", Privilege: NoPrivileges}}, nil
}
8715
func (s *Device) SetPermissions(v []*string) *Device {
	s.Permissions = v
	return s
}
344622
func NewGrantPermissionsArgs(origin string, permissions []PermissionType) *GrantPermissionsArgs {
	args := new(GrantPermissionsArgs)
	args.Origin = origin
	args.Permissions = permissions
	return args
}
96910
func (p *UserPrivileges) RequestVerification(activeRoles []*auth.RoleIdentity, db, table, column string, priv mysql.PrivilegeType) bool {
	if SkipWithGrant {
		return true
	}

	if p.user == "" && p.host == "" {
		return true
	}

	// Skip check for INFORMATION_SCHEMA database.
	// See https://dev.mysql.com/doc/refman/5.7/en/information-schema.html
	if strings.EqualFold(db, "INFORMATION_SCHEMA") {
		return true
	}

	mysqlPriv := p.Handle.Get()
	return mysqlPriv.RequestVerification(activeRoles, p.user, p.host, db, table, column, priv)
}
76913
func OwnerPermissions(orgID ID) []Permission {
	ps := []Permission{}
	for _, r := range AllResourceTypes {
		for _, a := range actions {
			if r == OrgsResourceType {
				ps = append(ps, Permission{Action: a, Resource: Resource{Type: r, ID: &orgID}})
				continue
			}
			ps = append(ps, Permission{Action: a, Resource: Resource{Type: r, OrgID: &orgID}})
		}
	}
	return ps
}
431368
func CheckPrivilege(activeRoles []*auth.RoleIdentity, pm privilege.Manager, vs []visitInfo) error {
	for _, v := range vs {
		if !pm.RequestVerification(activeRoles, v.db, v.table, v.column, v.privilege) {
			if v.err == nil {
				return ErrPrivilegeCheckFail
			}
			return v.err
		}
	}
	return nil
}
391671
func (s *CreateContinuousQueryStatement) RequiredPrivileges() (ExecutionPrivileges, error) {
	ep := ExecutionPrivileges{{Admin: false, Name: s.Database, Privilege: ReadPrivilege}}

	// Selecting into a database that's different from the source?
	if s.Source.Target.Measurement.Database != "" {
		// Change source database privilege requirement to read.
		ep[0].Privilege = ReadPrivilege

		// Add destination database privilege requirement and set it to write.
		p := ExecutionPrivilege{
			Admin:     false,
			Name:      s.Source.Target.Measurement.Database,
			Privilege: WritePrivilege,
		}
		ep = append(ep, p)
	}

	return ep, nil
}
423925
func (client *FakeTabletManagerClient) GetPermissions(ctx context.Context, tablet *topodatapb.Tablet) (*tabletmanagerdatapb.Permissions, error) {
	return &tabletmanagerdatapb.Permissions{}, nil
}
672503
func NewPrivilegeCacheService(context servicecontext.ServiceContext, config PrivilegeCacheServiceConfiguration) service.PrivilegeCacheService {
	return &privilegeCacheServiceImpl{
		BaseService: base.NewBaseService(context),
		conf:        config,
	}
}