Preferences "system" from everyone

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Firyo
    Senior Member
    • Jun 2022
    • 134

    Preferences "system" from everyone

    Hello there,

    I currently am trying to fix a problem about the preferences system of espo, I always get the preferences of the "system", even if my user have registered preferences in my database.
    What I get from this route (api/v1/App/user) is this
    Click image for larger version

Name:	image.png
Views:	372
Size:	55.6 KB
ID:	82476

    and as you can see this isn't my user's preferences but the global preferences.
    So if anyone knows how to fix this I'll be happy to hear how to fix it.​


    King regards,
    Firyo.
  • lazovic
    Super Moderator
    • Jan 2022
    • 809

    #2
    Hi Firyo,

    Try using a request like this:
    Code:
    https://your-espo-url/api/v1/Preferences/[your_user_id]

    Comment

    • yuri
      Member
      • Mar 2014
      • 8440

      #3
      Have never encountered this problem before.
      If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.

      Comment

      • Firyo
        Senior Member
        • Jun 2022
        • 134

        #4
        Originally posted by lazovic
        Hi Firyo,

        Try using a request like this:
        Code:
        https://your-espo-url/api/v1/Preferences/[your_user_id]
        Thanks for your answer,
        This URL returns the user's preferences so It's fine on this one.

        The problem that I have is that by default the "/api/v1/App/user" route gives me the system preferences everytime.
        The current user preferences are like bypassed by the system's.

        I started digging into the PHP code that handles this request and the preferences are coming from the function getValueMap() from the entity Espo\Entities\Preferences.
        Last edited by Firyo; 09-05-2022, 12:46 PM.

        Comment

        • lazovic
          Super Moderator
          • Jan 2022
          • 809

          #5
          Firyo,

          Very strange. On EspoCRM version 7.1.11, the Preferences mapping through /api/v1/App/user request looks like this:

          Click image for larger version

Name:	11.png
Views:	299
Size:	63.9 KB
ID:	82620Click image for larger version

Name:	12.png
Views:	300
Size:	105.9 KB
ID:	82619

          Comment

          • Firyo
            Senior Member
            • Jun 2022
            • 134

            #6
            Originally posted by lazovic
            Firyo,

            Very strange. On EspoCRM version 7.1.11, the Preferences mapping through /api/v1/App/user request looks like this:

            Click image for larger version  Name:	11.png Views:	0 Size:	63.9 KB ID:	82620Click image for larger version  Name:	12.png Views:	0 Size:	105.9 KB ID:	82619
            I'm also on the version 7.1.11.

            I've added a line of code in the getUserData function of Services/App.php and It's working well (even if It's not the best way of doing it I think)
            Click image for larger version

Name:	image.png
Views:	164
Size:	35.5 KB
ID:	82624
            Attached Files

            Comment

            Working...