c0sco / ansible-modules-bitwarden

Bitwarden integrations for Ansible
GNU General Public License v3.0
107 stars 44 forks source link

ADD: Organization and Collection to lookup. #22

Open atta opened 2 years ago

atta commented 2 years ago

This will enable lager bitwarden deployments to make use of collections. In order to have the same key stored with different values, for multiple environments

atta commented 2 years ago

@c0sco hey can we talk about this request and your opinion on it!?

evrardjp commented 2 years ago

Any interest in this?

kemcon commented 2 years ago

there is a bug in def get_custom_field(self, key, field, organizationId=None, collectionId=None): the original def get_entry is always a string, but your def get_entry is json, so you dont need to json.loads(self.get_entry...

just do:

    def get_custom_field(self, key, field, organizationId=None, collectionId=None):
        data = self.get_entry(key, 'item', organizationId, collectionId)
        return next(x for x in data['fields'] if x['name'] == field)['value']
atta commented 2 years ago

there is a bug in def get_custom_field(self, key, field, organizationId=None, collectionId=None): the original def get_entry is always a string, but your def get_entry is json, so you dont need to json.loads(self.get_entry...

Thanks for the hint i did some work today toi change the way how custom fields and attachments work with Organization and Collection https://github.com/c0sco/ansible-modules-bitwarden/pull/25

kemcon commented 2 years ago

there is a bug in def get_custom_field(self, key, field, organizationId=None, collectionId=None): the original def get_entry is always a string, but your def get_entry is json, so you dont need to json.loads(self.get_entry...

Thanks for the hint i did some work today toi change the way how custom fields and attachments work with Organization and Collection #25

your welcome. i started my own fork and added a lot, but with breaking changed. especially i got rid of custom value and now one can read every single value or list from the item-json. the custom values are available with "fields.valuename", but "id" ist also possible and organziation id and collection id is available too and all is working always with the names instead of the ids.