Difference between revisions of "Knowledge:Convert database users to ldap"
From OpenKM Documentation
(Created page with '===ORACLE=== For each user should create new user and delete older: <source lang="sql"> SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUE…') |
|||
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
===ORACLE=== | ===ORACLE=== | ||
For each user should create new user and delete older: | For each user should create new user and delete older: | ||
+ | Create new user: | ||
<source lang="sql"> | <source lang="sql"> | ||
− | SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' || ' | + | SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' || 'newname' || ''', ''' || USR_NAME || ''', ''' || USR_PASSWORD || ''', ''' || USR_EMAIL || ''', ''' || USR_ACTIVE || ''');' FROM OKM_USER WHERE USR_ID='oldername'; |
+ | SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' || 'newname'|| ''', ''' || UR_ROLE || ''');' FROM OKM_USER_ROLE where UR_USER='oldername'; | ||
+ | SELECT 'INSERT INTO OKM_USER_CONFIG (UC_USER, UC_HOME_PATH, UC_HOME_NODE, UC_HOME_TYPE, UC_PROFILE) VALUES (''' || 'newname' || ''', ''' || UC_HOME_PATH || ''', ''' || UC_HOME_NODE || ''', ''' || UC_HOME_TYPE || ''');' FROM OKM_USER_CONFIG WHERE UC_USER='oldername'; | ||
+ | </source> | ||
+ | |||
+ | Updating some tables: | ||
+ | '''ALERT''' there're two non controled tables OKM_USER_NODE and OKM_USER_NODE_KEYWORDS | ||
+ | <source lang="sql"> | ||
+ | UPDATE OKM_USER_ITEMS SET UI_USER='newname' where UI_USER='oldername'; | ||
+ | UPDATE OKM_NODE_USER_PERMISSION SET NUP_USER='newname' where NUP_USER='oldername' | ||
+ | </source> | ||
+ | |||
+ | Then should delete older users: | ||
+ | <source lang="sql"> | ||
+ | delete FROM OKM_USER_ROLE where UR_USER='oldername'; | ||
+ | delete FROM OKM_USER where USR_ID = 'oldername'; | ||
+ | </source> | ||
+ | |||
+ | == Script para renombrar las carpetas base del usuario == | ||
+ | <source lang="java"> | ||
+ | import com.openkm.api.OKMFolder; | ||
+ | |||
+ | String olderName = "fguasch"; | ||
+ | String newName = "fernando.guasch"; | ||
+ | OKMFolder.getInstance().rename(null, "/okm:personal/"+olderName, newName); | ||
+ | OKMFolder.getInstance().rename(null, "/okm:trash/"+olderName, newName); | ||
+ | OKMFolder.getInstance().rename(null, "/okm:mail/"+olderName, newName); | ||
</source> | </source> |
Latest revision as of 12:48, 4 October 2012
ORACLE
For each user should create new user and delete older: Create new user:
SELECT 'INSERT INTO OKM_USER (USR_ID, USR_NAME, USR_PASSWORD, USR_EMAIL, USR_ACTIVE) VALUES (''' || 'newname' || ''', ''' || USR_NAME || ''', ''' || USR_PASSWORD || ''', ''' || USR_EMAIL || ''', ''' || USR_ACTIVE || ''');' FROM OKM_USER WHERE USR_ID='oldername';
SELECT 'INSERT INTO OKM_USER_ROLE (UR_USER, UR_ROLE) VALUES (''' || 'newname'|| ''', ''' || UR_ROLE || ''');' FROM OKM_USER_ROLE where UR_USER='oldername';
SELECT 'INSERT INTO OKM_USER_CONFIG (UC_USER, UC_HOME_PATH, UC_HOME_NODE, UC_HOME_TYPE, UC_PROFILE) VALUES (''' || 'newname' || ''', ''' || UC_HOME_PATH || ''', ''' || UC_HOME_NODE || ''', ''' || UC_HOME_TYPE || ''');' FROM OKM_USER_CONFIG WHERE UC_USER='oldername';
Updating some tables: ALERT there're two non controled tables OKM_USER_NODE and OKM_USER_NODE_KEYWORDS
UPDATE OKM_USER_ITEMS SET UI_USER='newname' where UI_USER='oldername';
UPDATE OKM_NODE_USER_PERMISSION SET NUP_USER='newname' where NUP_USER='oldername'
Then should delete older users:
delete FROM OKM_USER_ROLE where UR_USER='oldername';
delete FROM OKM_USER where USR_ID = 'oldername';
Script para renombrar las carpetas base del usuario
import com.openkm.api.OKMFolder;
String olderName = "fguasch";
String newName = "fernando.guasch";
OKMFolder.getInstance().rename(null, "/okm:personal/"+olderName, newName);
OKMFolder.getInstance().rename(null, "/okm:trash/"+olderName, newName);
OKMFolder.getInstance().rename(null, "/okm:mail/"+olderName, newName);