elgentos/masquerade

Custom config files do not seem to be working

Closed this issue · 6 comments

Issue: I followed the documentation surrounding how to add custom config values, but masquerade does not seem to find my custom configuration.

My ultimate goal is to completely override the admin.yaml file, as I don't want to masquerade any values in the admin_user table. But I'm first trying to get masquerade to pickup my custom config files.

Steps to reproduce:

  1. Create a config/admin.yaml file with these contents:

    admin:
      admin_user:
        pk: user_id
        columns:
          firstname:
            formatter: firstName
          lastname2:
            formatter: lastName
    
  2. Run masquerade groups

Expected results:

+----------+------------------+---------------------------------------+--------------------+---------------------+
| Platform | Group            | Table                                 | Column             | Formatter           |
+----------+------------------+---------------------------------------+--------------------+---------------------+
| magento2 | admin            | admin_user                            | firstname          | email           |
| magento2 | admin            | admin_user                            | lastname           | lastName            |
| magento2 | admin            | admin_user                            | lastname2          | lastName            |
| magento2 | admin            | admin_user                            | email              | email               |
| magento2 | admin            | admin_user                            | username           | firstName           |
| magento2 | admin            | admin_user                            | password           | password            |
…

Actual results:

+----------+------------------+---------------------------------------+--------------------+---------------------+
| Platform | Group            | Table                                 | Column             | Formatter           |
+----------+------------------+---------------------------------------+--------------------+---------------------+
| magento2 | admin            | admin_user                            | firstname          | firstName           |
| magento2 | admin            | admin_user                            | lastname           | lastName            |
| magento2 | admin            | admin_user                            | email              | email               |
| magento2 | admin            | admin_user                            | username           | firstName           |
| magento2 | admin            | admin_user                            | password           | password            |
…

Screenshot, verifying my setup:

masquerade

@erikhansen aaah I guess the docs are wrong. Could you try renaming admin.yaml to config.yaml? Also see https://github.com/elgentos/masquerade/blob/master/src/Elgentos/Masquerade/Helper/Config.php#L33

Hmm no that's the config file, not the rulesets.

@erikhansen could you try placing it in config/magento2/admin.yaml, the same as the structure in the repo? https://github.com/elgentos/masquerade/blob/master/src/config/magento2/admin.yaml

@peterjaap Placing the file in config/magento2/admin.yaml worked. Thanks for your help!

I found that if the admin.yaml file was empty, nothing happened. However once I placed the below contents in the file, the masquerade groups command output no longer included any reference to the admin group, which was my desired effect.

admin:

I would have offered to update the docs, but you may have an idea in mind about how you want to communicate about the configuration (and whether or not to document how to "undo" a default configuration as I mention above).

@erikhansen thanks, for now I just updated the readme :)