func (sp standardPermissions) defaultForEndpoint(endpoint string) ([]Code, error) {
	perms := sp.permissionsForEndpoint(endpoint)

	if len(perms) == 0 {
		return []Code{}, errors.New("no default permissions found")
	}

	// only one permission so always DEFAULT
	if len(perms) == 1 {
		code := []Code{perms[0].Code}
		return code, nil
	}

	codes := []Code{}
	for _, p := range perms {
		if p.Default {
			codes = append(codes, p.Code)
		}
	}
	if len(codes) > 0 {
		return codes, nil
	}

	return []Code{}, errors.New("no default permissions found, but found more than one")
}
// defaultForEndpoint finds the default permissions for an endpoint
// i.e. slice of permission codes marked as default true
defaultForEndpoint finds the default permissions for an endpoint
i.e. slice of permission codes marked as default true
// defaultForEndpoint finds the default permissions for an endpoint // i . e . slice of permission codes marked as default true
func (sp standardPermissions) defaultForEndpoint(endpoint string) ([]Code, error) {
	perms := sp.permissionsForEndpoint(endpoint)
	if len(perms) == 0 {
		return []Code{}, errors.New("no default permissions found")
	}
	if len(perms) == 1 {
		code := []Code{perms[0].Code}
		return code, nil
	}
	codes := []Code{}
	for _, p := range perms {
		if p.Default {
			codes = append(codes, p.Code)
		}
	}
	if len(codes) > 0 {
		return codes, nil
	}
	return []Code{}, errors.New("no default permissions found, but found more than one")
}
func ( sp standardPermissions ) defaultForEndpoint ( endpoint string ) ( [ ] Code , error ) { perms := sp . permissionsForEndpoint ( endpoint ) if len ( perms ) == 0 { return [ ] Code { } , errors . New ( " " ) } if len ( perms ) == 1 { code := [ ] Code { perms [ 0 ] . Code } return code , nil } codes := [ ] Code { } for _ , p := range perms { if p . Default { codes = append ( codes , p . Code ) } } if len ( codes ) > 0 { return codes , nil } return [ ] Code { } , errors . New ( " " ) }
defaultForEndpoint finds the default permissions for an endpoint
i.e.
defaultForEndpoint finds the default permissions for an endpoint i . e .
// only one permission so always DEFAULT