-1

is it possible to rename alfresco local user accounts ? is there any way to update the user renaming/update via Postgres sql ? Below code as found to list the users. Kindly share the update query

Thanks

    SELECT n.id,
  n.uuid,
  p1.string_value AS "Username",
  p2.boolean_value AS "Enabled",
  q.local_name AS "Type"
FROM alf_node AS n,
  alf_qname AS q,
  alf_node_properties AS p1,
  alf_node_properties AS p2
WHERE n.type_qname_id=q.id
  AND n.id=p1.node_id
  AND p1.node_id=p2.node_id
  AND p1.string_value!=''
  AND
    ((
      q.local_name='person'
      AND
      p1.qname_id IN (SELECT id FROM alf_qname WHERE local_name='userName')
    ) OR (
      q.local_name='user'
      AND
      p1.qname_id IN (SELECT id FROM alf_qname WHERE local_name='username')
    ))
  AND p2.qname_id IN (SELECT id FROM alf_qname WHERE local_name='enabled')
ORDER BY p1.string_value;
 
Ck_7
  • 469
  • 7
  • 12
  • 2
    IIRC you need to update a bunch of places stored in the repository as well, not just the user node. Why not just do the rename through the Alfresco repository services as normal? – Gagravarr May 24 '22 at 15:16
  • 2
    It's not recommended to do updates in database, you can use javascript or java api, or as mentionned by @Gagravarr, use public service : https://api-explorer.alfresco.com/api-explorer/#/people/updatePerson – 3omar May 25 '22 at 12:45
  • Can you provide any example to update user ID ? With above API @3omar – Ck_7 May 26 '22 at 07:28
  • There are no properties as found for the field ID to rename user ids through api. – Ck_7 May 26 '22 at 09:18
  • may I ask why you want to rename a user (I'd just like to understand your use case)? – Heiko Robert May 31 '22 at 12:36
  • 5000 users were created with local user in alfresco. I had requirement to migrate those users into AD user. I had NO problem if the user having same account name. Example if local user account presents alfresco_test and in AD same account presents alfresco_test then I can log in via AD authentication for the local user account alfresco_test. – Ck_7 May 31 '22 at 12:55

1 Answers1

1

Unfortunately, there is no supported way to change the user name in Alfresco. Alfresco uses the user ID as a foreign key in many places. Trying to rename users directly in the database is a bad idea and can lead to many inconsistencies and will cause problems later when you don't even expect it anymore.

It is best to use non-semantic user names, such as a number, to avoid privacy or compliance violations.

Heiko Robert
  • 2,488
  • 11
  • 12