// AnyGranted checks if any role has the permission.
771497
func AnyGranted(rbac *RBAC, roles []string, permission Permission,
	assert AssertionFunc) (rslt bool) {
	rbac.mutex.Lock()
	for _, role := range roles {
		if rbac.isGranted(role, permission, assert) {
			rslt = true
			break
		}
	}
	rbac.mutex.Unlock()
	return rslt
}
1069933
func (r *Route) AnyFunc(f http.HandlerFunc) *Route {
	return r.Any(http.HandlerFunc(f))
}
833765
func (s *CreateBucketInput) SetGrantRead(v string) *CreateBucketInput {
	s.GrantRead = &v
	return s
}
662056
func (e *SyncedEnforcer) HasPermissionForUser(user string, permission ...string) bool {
	e.m.Lock()
	defer e.m.Unlock()
	return e.Enforcer.HasPermissionForUser(user, permission...)
}
1066268
func (r *RepositoryInvitation) GetPermissions() string {
	if r == nil || r.Permissions == nil {
		return ""
	}
	return *r.Permissions
}
582908
func IsPermissionDenied(err error) bool {
	pd, ok := err.(permissionDeniedError)
	return ok && pd.IsPermissionDenied()
}
798887
func (s *CopyObjectInput) SetGrantRead(v string) *CopyObjectInput {
	s.GrantRead = &v
	return s
}
1160145
func (s *PutObjectInput) SetGrantFullControl(v string) *PutObjectInput {
	s.GrantFullControl = &v
	return s
}
207829
func (s *PutBucketAclInput) SetGrantRead(v string) *PutBucketAclInput {
	s.GrantRead = &v
	return s
}
450862
func (c *Etcd2Lock) assertHeld() error {
	held, err := c.isHeld()
	if err != nil {
		return err
	}

	// Check if we don't hold the lock.
	if !held {
		return EtcdLockNotHeldError
	}
	return nil
}
949956
func PermissionAllowed(p Permission, ps []Permission) bool {
	pID := ID(0)
	if p.ID != nil {
		pID = *p.ID
		if !pID.Valid() {
			return false
		}
	}

	for _, perm := range ps {
		permID := ID(0)
		if perm.ID != nil {
			permID = *perm.ID
			if !permID.Valid() {
				return false
			}
		}
		if perm.Action == p.Action && perm.Resource == p.Resource && permID == pID {
			return true
		}
	}
	return false
}
430131
func (ap AccountPermissions) HasRole(role string) bool {
	role = string(binary.RightPadBytes([]byte(role), 32))
	for _, r := range ap.Roles {
		if r == role {
			return true
		}
	}
	return false
}
711439
func CheckTrusted(c *yaml.Container) error {
	if c.Privileged {
		return fmt.Errorf("Insufficient privileges to use privileged mode")
	}
	if len(c.DNS) != 0 {
		return fmt.Errorf("Insufficient privileges to use custom dns")
	}
	if len(c.DNSSearch) != 0 {
		return fmt.Errorf("Insufficient privileges to use dns_search")
	}
	if len(c.Devices) != 0 {
		return fmt.Errorf("Insufficient privileges to use devices")
	}
	if len(c.ExtraHosts) != 0 {
		return fmt.Errorf("Insufficient privileges to use extra_hosts")
	}
	if len(c.Network) != 0 {
		return fmt.Errorf("Insufficient privileges to override the network")
	}
	if c.OomKillDisable {
		return fmt.Errorf("Insufficient privileges to disable oom_kill")
	}
	if len(c.Volumes) != 0 {
		return fmt.Errorf("Insufficient privileges to use volumes")
	}
	if len(c.VolumesFrom) != 0 {
		return fmt.Errorf("Insufficient privileges to use volumes_from")
	}
	return nil
}
429550
func NewGrantCheck(check GrantChecker, handler GrantHandler, errorHandler GrantErrorHandler) osinserver.AuthorizeHandler {
	return &GrantCheck{check, handler, errorHandler}
}
417746
func IsErrPermissionDenied(err error) bool {
	return err != nil && strings.Contains(err.Error(), errPermissionDenied)
}
1187025
func (rcv groups) Any(fn func(group) bool) bool {
	for _, v := range rcv {
		if fn(v) {
			return true
		}
	}
	return false
}
952081
func ToGrant(username string, perm chronograf.Permission) string {
	if len(perm.Allowed) == 0 {
		return ""
	}
	return ToInfluxQL("GRANT", "TO", username, perm)
}