You are not logged in.

Announcement

 Téléchargez la dernière version stable de GLPI      -     Et vous, que pouvez vous faire pour le projet GLPI ? :  Contribuer
 Download last stable version of GLPI                      -     What can you do for GLPI ? :  Contribute

#1 2023-01-30 21:59:41

jlms77
Member
Registered: 2020-02-02
Posts: 2

Super admin user GLPI with no permissions to add user email via API Re

Hi,

Im trying to create users via api rest, i have cretated the user using the REST Api but now i need to add the email address.

I am doing all my tests with the superadmin user "GLPI" token  but im getting the error:

[
    "ERROR_GLPI_ADD",
    "You don't have permission to perform this action."
]

Im testing with postman with the the following parameters:


Headers:

Content-Type application/json
Session-Token jsg8gjjb2e2bk32l2krg7qzti1 (Obtained using the glpi user token)


I want to add the email for the user 93:


URL: https://localhost/apirest.php/user/93/Useremail

Body payload:

{
    "input": {
        "user_id": "93",
        "is_default": "1",
        "is_dynamic": "0",
        "email": "testest@test.com"
            }
}

Then when i hit the send button i get the no permission error.

Is there any other permissions that i have to activate to add the email to the user?

Offline

#2 2023-01-31 13:23:19

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,809
Website

Re: Super admin user GLPI with no permissions to add user email via API Re

The type names in the URL are case sensitive; They should be User and UserEmail. Also, the user ID property should be "users_id".

Otherwise, I was not able to recreate the issue. I suggest checking the /getActiveProfile endpoint to verify you are currently using the Super-Admin profile in case your user has more than one.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#3 2023-09-14 20:10:22

renan.redel
Member
Registered: 2023-09-14
Posts: 4

Re: Super admin user GLPI with no permissions to add user email via API Re

Hi @jlms77;

I'm facing the same issue.
Did you find the solution ?

I also open a issue in the github repo.

https hmm/github.com/glpi-project/glpi/issues/15576

Last edited by renan.redel (2023-09-14 20:10:41)

Offline

#4 2023-09-15 14:26:46

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,809
Website

Re: Super admin user GLPI with no permissions to add user email via API Re

In your case, it seems you were missing the "users_id" property.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

#5 2023-09-15 15:51:15

renan.redel
Member
Registered: 2023-09-14
Posts: 4

Re: Super admin user GLPI with no permissions to add user email via API Re

cconard96 wrote:

In your case, it seems you were missing the "users_id" property.

Thank you so much!

Offline

#6 2023-09-15 16:01:55

cconard96
Moderator
Registered: 2018-07-31
Posts: 2,809
Website

Re: Super admin user GLPI with no permissions to add user email via API Re

No problem. For more information about the new API I mentioned in the GitHub issue, you can find the initial pull request for it here:
https://github.com/glpi-project/glpi/pull/12221

It is still a work in progress.


GLPI Collaborator and Plugin Developer.
My non-English comments are automated translations. Sorry for any confusion that causes.
Mes commentaires non anglais sont des traductions automatiques. Désolé pour toute confusion qui cause.
Mis comentarios que no están en inglés son traducciones automáticas. Perdón por cualquier confusión que cause.

Offline

Board footer

Powered by FluxBB