passbolt / go-passbolt-cli

A CLI tool to interact with Passbolt, a Open source Password Manager for Teams
https://passbolt.com
MIT License
60 stars 14 forks source link

feature/CEL filter implementation #26

Closed PiMaDaum closed 1 year ago

PiMaDaum commented 1 year ago

In addition to PR #23 I have implemented a filter function for resources with the cel-go library. It can be used to built dynamic filter expressions over all available columns. Example: --filter '(Name == "SomeName" || matches(Name, "RegExpr")) && URI.startsWith("https://auth.")' For the references to Password and Description, I have use function references. This guarantees, that the overhead with separated queries to the server will execute only when needed. I have also tested that if the reference is used multiple times, the execution only happens once. When you think this is fine, I can implement this solution for other commands too.

PiMaDaum commented 1 year ago

Hi @speatzle I outsourced the code of filtering in a separate file. And you're right. I don't know what my mistakes were, but in my first tests, the generation of a timestamp didn't work. So I implemented this overloading function. After reading the CEL specs and trying again, the built-in function timestamp(string) worked fine. I've written a second example in the argument description for this.

PiMaDaum commented 1 year ago

Hi @speatzle I've implemented the filter tag in the other sub-commands too. Please check and review the changes. I think now we have a usable functionality.