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

Project config and respect 'allowAdminChanges' => false #94

Closed
nettum opened this issue May 15, 2020 · 5 comments
Closed

Project config and respect 'allowAdminChanges' => false #94

nettum opened this issue May 15, 2020 · 5 comments
Assignees
Labels
bug Something isn't working

Comments

@nettum
Copy link

nettum commented May 15, 2020

Description

Even if you have 'allowAdminChanges' => false you can edit stripe settings (which I then assume will try to write settings back to project.yaml).

To get this plugin to work across multiple envs without messing up project.yaml I added the following to general.php:
image
and it seems to work nicely, but I assume there will be some challenges if I now edit some settings on staging or production env. This is from production env:
image

Should the Settings nav menu be unavaiable in envs with 'allowAdminChanges' => false?

Additional info

  • Craft version: 3.4.18
  • PHP version: 7.2
  • Database driver & version: MySQL 5.7
  • Plugin version: 2.6.1
@andrelopez andrelopez self-assigned this May 16, 2020
@andrelopez andrelopez added the question Further information is requested label May 16, 2020
@andrelopez
Copy link
Member

Hi,

Please save your settings as the follow example from our docs

<?php
return [
   // Global settings
   '*' => [
      ...
   ],

   // Dev environment settings
   'dev' => [
       // Dev Mode (see https://craftcms.com/support/dev-mode)
       'devMode' => true,
       'stripePayments' => [
           'testPublishableKey' => getenv('YOUR_TEST_PUBLISHABLE_KEY'),
           'testSecretKey' =>  getenv('YOUR_TEST_SECRET_KEY'),
           'testMode' => 1
       ]
   ],

   // Production environment settings
   'production' => [
       'stripePayments' => [
           'livePublishableKey' => getenv('YOUR_LIVE_PUBLISHABLE_KEY'),
           'liveSecretKey' => getenv('YOUR_LIVE_SECRET_KEY'),
           'testMode' => 0
       ]    
   ],
];

Users will be unable to save livePublishableKey, liveSecretKey or testMode on the different environments

This issue is more for a feature request to add user permissions to hide the settings right?

@nettum
Copy link
Author

nettum commented May 18, 2020

It's more a question if the plugin will support project config (which was introduced in craft cms 3.1).
See user docs here and plugin dev docs here.

As far as I can see this plugin (and the settings in the post above) will work nicely without project config, but with project config enabled it seems that you may run into some challenges.

An example:
I started out with a clean craft install and enabled project config.
The initial project config file looks like this:

dateModified: 1589830940
email:
  fromEmail: [email protected]
  fromName: 'Craft 200518'
  transportType: craft\mail\transportadapters\Sendmail
fieldGroups:
  b570cb16-8d35-4039-b6e8-76b88d2550a6:
    name: Common
siteGroups:
  3f6648be-17a7-439a-b313-0d5ff248bc79:
    name: 'Craft 200518'
sites:
  592bc7be-1d9c-434a-907d-308eab0885d4:
    baseUrl: $DEFAULT_SITE_URL
    handle: default
    hasUrls: true
    language: en-US
    name: 'Craft 200518'
    primary: true
    siteGroup: 3f6648be-17a7-439a-b313-0d5ff248bc79
    sortOrder: 1
system:
  edition: solo
  live: true
  name: 'Craft 200518'
  schemaVersion: 3.4.10
  timeZone: America/Los_Angeles
users:
  allowPublicRegistration: false
  defaultGroup: null
  photoSubpath: ''
  photoVolumeUid: null
  requireEmailVerification: true

After installing enupal stripe payments the project config file got updated with alot of matrixblocks (see this file).
Because of this I was for some reason unable to install the project on another environment.
Here are the error when running ./craft install with the attached project config file):

    > applying existing project config ... Exception: The following config paths could not be processed successfully:
matrixBlockTypes.f8fcd322-e3cf-4b4c-b9f9-62f5f5c6d85b
matrixBlockTypes.5d28bcc8-3f7d-4fd0-ade0-2f30dab7250b
matrixBlockTypes.036118cc-16f0-49c2-9834-60e6577ac005
matrixBlockTypes.4cb58a53-6728-49be-b4d6-d91b807cca2c
matrixBlockTypes.7d70c1c2-c7f7-4eee-9721-5eea53200986
matrixBlockTypes.1c0f107a-99e1-4bcf-aa26-d022078eb1ca
matrixBlockTypes.fe35aea7-b8e6-42e0-892d-8f8c4400a8c1
matrixBlockTypes.2ef464d7-a11b-43fd-bc3a-11b8558d1dcd 

Related comment

I guess maybe there are quite a few things that would need to be changed if the plugin should support project config (we use this on all projects now).

@andrelopez
Copy link
Member

@nettum Thanks for this info. I'll back to you if I have any questions

@andrelopez andrelopez added bug Something isn't working and removed question Further information is requested labels May 20, 2020
@andrelopez
Copy link
Member

I have reported a bug on Craft CMS here craftcms/cms#6161

@andrelopez
Copy link
Member

Hi, we just release Stripe Payments v2.7.0 with a fix to this issue. Please let us know if that works.

Please follow the next instructions:

  • From your primary environment, update Stripe Payments to v2.7.0
  • remove the config/project.yaml (we'll rebuild it on next steps)
  • Uninstall the plugin
  • Install the plugin
  • run php craft project-config/rebuild

The project config file should be fixed. Please let us know if it works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants