github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/internal/access/access.go (about)

     1  package access
     2  
     3  import (
     4  	"errors"
     5  
     6  	"github.com/ActiveState/cli/pkg/platform/authentication"
     7  	"github.com/ActiveState/cli/pkg/platform/model"
     8  )
     9  
    10  // Secrets determines whether the authorized user has access
    11  // to the current project's secrets
    12  func Secrets(orgName string, auth *authentication.Auth) (bool, error) {
    13  	_, err := model.FetchOrgMember(orgName, auth.WhoAmI(), auth)
    14  	if err != nil {
    15  		if errors.Is(err, model.ErrMemberNotFound) {
    16  			return false, nil
    17  		}
    18  		return false, err
    19  	}
    20  	return true, nil
    21  }