Something went wrong while setting issue due date.
uidNumber/gidNumber doesn't work when we use the webservice and a template
Closed
uidNumber/gidNumber doesn't work when we use the webservice and a template
Description
Hello, I want to create a user through the webservice with a fixed uidNumber and gidNumber.
Distribution Name and Version
Debian
FusionDirectory Version
1.4
Plugin with the defect
Webservice
PHP version used
PHP7
Origin of php packages
Debian
Steps to Reproduce
I first create a template that tick "force uidNumber and gidNumber"
dn: cn=test,ou=templates,ou=people,dc=demo-fusiondirectory,dc=org
objectClass: fdTemplate
fdTemplateField: force_ids:TRUE
fdTemplateField: loginShell:/bin/ash
fdTemplateField: mustchangepassword:FALSE
fdTemplateField: objectClass:inetOrgPerson
fdTemplateField: objectClass:organizationalPerson
fdTemplateField: objectClass:person
fdTemplateField: objectClass:posixAccount
fdTemplateField: objectClass:shadowAccount
fdTemplateField: userPassword:%askme%
cn: test
Source the next script after installing jq and fill URL, LOGIN, PASSWORD
#!/bin/env bash
declare URL=''
declare LOGIN=''
declare PASSWORD=''
# Short CURL
function C(){
command -- "curl" "-s" "-H" "Content-Type: application/json" "${URL}${@}"
}
# Grab TOKEN
TOKEN=$(C \
'/login' \
-X POST \
--data \
'{
"user": "'"$LOGIN"'",
"password": "'"$PASSWORD"'"
}'
)
TOKEN=$(tr -d '"' <<< "$TOKEN")
# Redfine C
function C(){
command -- "curl" "-s" "-H" "Content-Type: application/json" "-H" "SESSION-TOKEN: $TOKEN" "${URL}${@}" | jq .
}
Use the command to try creating the user I fill only uid, sn, givenName, homeDirectory and uidNumber gidNumber.
$ C /objects/user -X POST --data '{ "attrs": { "user": { "givenName": "givenname", "sn": "surname", "uid": "uid1", "userPassword": "test" }, "posixAccount": { "homeDirectory": "/home/uid", "uidNumber": 5000, "gidNumber": 5001 } }, "template": "cn=test,ou=templates,ou=people,dc=demo-fusiondirectory,dc=org"}'
[
{
"class": "WebServiceError",
"message": "new > Unix > User id: Attribute uidNumber is disabled, its value could not be set",
"line": 695,
"file": "/usr/share/fusiondirectory/include/webservice/class_fdRPCService.inc"
}
]
Expected behavior:
Creating the user with the right uid and gid number
Actual behavior:
It shows an error
Reproduces how often: 100