// Can checks whether an Action is allowed for a given bucket.
963743
func (p Permissions) Can(bucket string, action Action) bool {
	return (p[bucket] & action) == action
}
270092
func (p BucketPolicy) IsValidBucketPolicy() bool {
	switch p {
	case BucketPolicyNone, BucketPolicyReadOnly, BucketPolicyReadWrite, BucketPolicyWriteOnly:
		return true
	}
	return false
}
203145
func Can() (bool, error) {
	find := true
	_, err := exec.LookPath(gitCmd)
	if err != nil {
		find = false
	}
	return find, err
}
2391
func Action(a func(*cli.Context)) Option {
	return func(o *Options) {
		o.Action = a
	}
}
671867
func (s *Static) canBeServed(path string) bool {
	stat, err := os.Stat(path)
	if err != nil {
		log.Debugf("Error while calling os.Stat for path %s. Error: %s", path, err.Error())
	} else {
		if !stat.IsDir() {
			return true
		}
	}

	return false
}
970624
func (la *LogicalAggregation) canPullUp() bool {
	if len(la.GroupByItems) > 0 {
		return false
	}
	for _, f := range la.AggFuncs {
		for _, arg := range f.Args {
			expr := expression.EvaluateExprWithNull(la.ctx, la.children[0].Schema(), arg)
			if con, ok := expr.(*expression.Constant); !ok || !con.Value.IsNull() {
				return false
			}
		}
	}
	return true
}
1247833
func (r Resource) Validate(bucketName string) error {
	if !r.IsValid() {
		return fmt.Errorf("invalid resource")
	}

	if !wildcard.Match(r.BucketName, bucketName) {
		return fmt.Errorf("bucket name does not match")
	}

	return nil
}
306346
func (t *Tx) Bucket(b []byte) (kv.Bucket, error) {
	return t.BucketFn(b)
}
160573
func isValidStatement(statement Statement, bucketName string) bool {
	if statement.Actions.Intersection(validActions).IsEmpty() {
		return false
	}

	if statement.Effect != "Allow" {
		return false
	}

	if statement.Principal.AWS == nil || !statement.Principal.AWS.Contains("*") {
		return false
	}

	bucketResource := awsResourcePrefix + bucketName
	if statement.Resources.Contains(bucketResource) {
		return true
	}

	if statement.Resources.FuncMatch(startsWithFunc, bucketResource+"/").IsEmpty() {
		return false
	}

	return true
}
359426
func (policy *SizeRotatePolicy) CanRotate(fileLogWriter *FileLogWriter) bool {
	return fileLogWriter.count > policy.maxBytes
}
706880
func IsUnavailable(err error) bool {
	_, ok := getImplementer(err).(ErrUnavailable)
	return ok
}
1177583
func (l *Limiter) Bucket(name string) (b *Bucket, ok bool) {
	l.m.Lock()
	defer l.m.Unlock()
	b, ok = l.buckets[name]
	return
}
681333
func canBeNil(typ reflect.Type) bool {
	switch typ.Kind() {
	case reflect.Chan, reflect.Func, reflect.Interface, reflect.Map, reflect.Ptr, reflect.Slice:
		return true
	}
	return false
}
1270252
func (c *Context) IsEnabled(capability int) bool {
	return c.Call("isEnabled", capability).Bool()
}
1241765
func CanOrder(a, b interface{}) bool {
	ak, bk := reflect.ValueOf(a).Kind(), reflect.ValueOf(b).Kind()
	if ak != bk {
		return false
	}
	return CanOrderR(ak)
}
202133
func (m *Machine) Can(t string) bool {
	return m.fsm.Can(t)
}
1327057
func (c *cursor) Bucket() database.Bucket {
	// Ensure transaction state is valid.
	if err := c.bucket.tx.checkClosed(); err != nil {
		return nil
	}

	return c.bucket
}