Cloud deployment no admin privileges?

default discord avatar
CAPTKEN
last month
24

Can not create a page or a category as Admin after deploying the cloud standard website, anyone have this issue or am i missing something simple? I can create another user so I am baffled after looking through the config? Any help appreciated.

  • discord user avatar
    jesschow
    Payload Team
    last month

    Hey @CAPTKEN - I have replicated and am looking into this 👋



    @CAPTKEN we found the problem - if you go to your payload config, comment out lines

    46/47

    for cors/csrf and this problem should resolve. I'll be updating the template so this doesn't happen in the future!



    This is fixed in the template now, pull in the changes there and it should work as expected

    Screen_Shot_2023-04-05_at_2.27.57_PM.png
  • default discord avatar
    CAPTKEN
    last month

    Thanks for the update - Jess, will give it a try tonight



    @jesschow - unfortunately that not working on my end - also noticed on git - //cor: are on lines 44 and 45 you have 46 and 47



    Ok deleted the cloud instance and tried again now its working

    Screenshot_2023-04-05_at_5.02.18_PM.png
  • default discord avatar
    jaigo
    last month

    @jesschowthis seems to be not a solution. Still the issue is there.



    After uncommenting those two lines and adding slug manually resolves the issue. That means the slug generator is not working with input from title field and ends up in undefined.



    @jesschowmay check this and please update repository.



    @jesschowAgain the save draft does not work here. I could publish directly after a slug input. Save draft returns nothing found page.



    @jesschowanother guess is that PoplateArchiveBlock hook has something weired in it.

    mv1-08-04-2023-230822.jpg
    mv1-09-04-2023-003819.jpg
  • discord user avatar
    jesschow
    Payload Team
    last month

    Hi @jaigo - to clarify, your issue is that after clicking 'save draft' on a page it returns the

    nothing found

    page?

  • default discord avatar
    jaigo
    last month

    Yes that is for page and posts collection.

  • discord user avatar
    jesschow
    Payload Team
    last month

    @jaigo I haven't been able to replicate this - we pushed a few updates to the template last week, can you check you have all the latest changes?

  • default discord avatar
    jaigo
    last month

    @jesschowI am talking about cloud installation. The issue is there.

  • discord user avatar
    jesschow
    Payload Team
    last month

    @jaigo I understand that you've created this project from payload cloud - which template did you select? the website starter?

  • default discord avatar
    jaigo
    last month

    yes

  • discord user avatar
    jesschow
    Payload Team
    last month

    @jaigo and if you start another project using the website starter, are you seeing the same issue?

  • default discord avatar
    jaigo
    last month

    yes everytime. I tried this several times after removing entirely the project and redoing. but still there is this issue. when I checkout the repo to local and change access control methods using the files available in website-cms repo and modify formatslug.ts a bit the issue is over locally. I didnt replace that remote.

  • discord user avatar
    jesschow
    Payload Team
    last month

    @jaigo I'm trying to replicate again



    @jaigo the

    adminOrPublished

    read access control wasn't checking the

    admin

    role correctly, I've pushed a fix to the repo, try that and let me know how it goes.



    Or you can update the

    src/access/adminOrPublished.ts

    file in your repo to this:



    import type { Access } from 'payload/config'
    import { checkRole } from '../collections/Users/checkRole'
    
    export const adminsOrPublished: Access = ({ req: { user } }) => {
      if (user && checkRole(['admin'], user)) {
        return true
      }
    
      return {
        _status: {
          equals: 'published',
        },
      }
    }
  • default discord avatar
    jaigo
    last month

    Yes, That did it...!!!!. I made a direct commit to the file and tested it. Now working. Thank you for your quick response.



    @jesschowThank you very much

  • discord user avatar
    jesschow
    Payload Team
    last month

    @jaigo woo woo happy to help! 🙌

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.