Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ability to disable metadata #62

Closed
mlipscombe opened this issue Nov 24, 2019 · 9 comments
Closed

ability to disable metadata #62

mlipscombe opened this issue Nov 24, 2019 · 9 comments
Labels
enhancement New feature or request

Comments

@mlipscombe
Copy link

Currently, several metadata fields are automatically created/updated, like createdate, lastupdate, createdby and updatedby. This leaks information (for example, the email addresses of admin users) into documents that may be publicly accessible, and should be able to be disabled.

I can make a PR to add an option like nometadata if that would be acceptable.

@benwinding
Copy link
Owner

benwinding commented Nov 24, 2019 via email

@LaszloDev LaszloDev added the enhancement New feature or request label Jan 5, 2020
@davidstackio
Copy link
Contributor

I agree this would be beneficial. Or even being able to pass an array of fields you want to use (in case you want lastupdate, but not the updatedby, for example). I'm also an advocate of changing the names to be camelCase for easier readability. Like this:

  • createdate -> createDate
  • lastupdate ->lastUpdate
  • createdby -> createdBy
  • updatedby -> updatedBy

@RWOverdijk
Copy link
Contributor

I agree. This is a privacy issue and makes the whole library unusable. @mlipscombe did you end up making a PR?

@benwinding what's the fastest way to just disable this altogether?

@benwinding
Copy link
Owner

Hey Guys,

Yes this has been an annoying thing for a while. It's now an option in the options object:

const options = {
  // Disable the metadata; 'createdate', 'lastupdate', 'createdby', 'updatedby'
  disableMeta: true
}

Available in [email protected]

@dhstack maybe we should open another issue for renaming the field names.

Let me know if there's any issues,

Cheers,
Ben

@RWOverdijk
Copy link
Contributor

RWOverdijk commented Mar 21, 2020

@benwinding Thanks for your quick reply :) This looks great, because we can already add hooks and add our own fields if we want.

@davidstackio
Copy link
Contributor

@benwinding This works, thanks!

@mattsears18
Copy link

is it possible to rename the metadata fields with custom names?

@benwinding
Copy link
Owner

Hi @mattsears18,
No it's currently not possible. You can change the casing of the meta data fields though.

const options = {
  // Casing for meta fields like 'createdby' and 'updatedby', defaults to 'lower' 
  // options are: 'lower' | 'camel' | 'snake' | 'pascal' | 'kebab'
  metaFieldCasing: 'lower'
}

const dataProvider = FirebaseDataProvider(config, options);

@mattsears18
Copy link

@benwinding thanks! that will work for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

6 participants