Page 1 of 1

Transfer private objects from one user to another

Posted: Thu Nov 23, 2023 6:50 pm
by Wim Gielis
Hi all,

I thought this TI process might be useful to others as well. I have been writing this over the past couple of days, so if anyone wants to further test it, much appreciated !

The idea is that users in a TM1 model can have private objects:
- subsets (*.sub files)
- classic views (*.vue files)
- MDX views (*.xbv files)
- application entries

These objects are stored in the TM1 data directory following the username and/or a namespace.

Transferring such objects can be easy if it's not a lot of files, but in the Applications folder structure this can occur in multiple places.
If you have many users to do, it's not much fun.
For instance, when migrating an on-premise TM1 model to the IBM cloud, this can take time.
Namespaces can change, usernames can change, hence, folder names can change.

The process uses PowerShell to copy folders and files from source user to target user.
The process also allows to transfer to a different user, in that case I implemented it as first a copy, then delete files. No Move-Item commands in PowerShell.

The keyword 'IDEM' can be used to keep the same target username as source username, or the same source username as target username (where namespaces can differ).

Also, an attribute on the }Clients dimension can be used to automatically loop over all clients and migrate the objects.

After a (short) while this topic can go to the Useful stuff subforum if it turns out to be useful :lol: at least to me it is !

The target user should just log out an log in to see the new private objects. The TM1 model does not need to be restarted.

In V12 this process will have to be revisited. If anyone wants to set it up with the TM1 REST API or tm1py or similar, go ahead and reuse my logic where possible !


Code: Select all

# If the process call is like this:

# ExecuteProcess( 'WG_transfer_private_objects', 'pUserName_Src', pUserName_Src, 'pUserName_Tgt', pUserName_Tgt, 'pRootFolder_Src', pRootFolder_Src, 'pRootFolder_Tgt', pRootFolder_Tgt, 'pClientsLoop', pClientsLoop, 'pOperation', pOperation );

# then examples can include:

# pUserName_Src = 'Gielis Wim';
# pUserName_Tgt = 'IDEM';
# pRootFolder_Src = 'ABC';
# pRootFolder_Tgt = 'Planning Analytics';
# pClientsLoop = '';
# pOperation = 'Copy (or Move)';


# pUserName_Src = 'ABC\Gielis Wim';
# pUserName_Tgt = 'Planning Analytics\Wim Gielis';
# pRootFolder_Src = '';
# pRootFolder_Tgt = '';
# pClientsLoop = '';
# pOperation = 'Copy (or Move)';


# pUserName_Src = 'Gielis Wim';
# pUserName_Tgt = 'Planning Analytics\Wim Gielis';
# pRootFolder_Src = 'ABC';
# pRootFolder_Tgt = '';
# pClientsLoop = '';
# pOperation = 'Copy (or Move)';


# pUserName_Src = 'Gielis Wim';
# pUserName_Tgt = 'IDEM';
# pRootFolder_Src = 'ABC';
# pRootFolder_Tgt = '';
# pClientsLoop = '';
# pOperation = 'Copy (or Move)';


# pUserName_Src = 'IDEM';
# pUserName_Tgt = 'Gielis Wim';
# pRootFolder_Src = '';
# pRootFolder_Tgt = '';
# pClientsLoop = '';
# pOperation = 'Copy (or Move)';


# pUserName_Src = 'Gielis Wim';
# pUserName_Tgt = 'CAMID("pans:u:wgielis@aexis.com")';
# pRootFolder_Src = 'ABC';
# pRootFolder_Tgt = '';
# pClientsLoop = '';
# pOperation = 'Copy (or Move)';


# pUserName_Src = '';
# pUserName_Tgt = '';
# pRootFolder_Src = '';
# pRootFolder_Tgt = '';
# pClientsLoop = 'Src=Source user from ABC';
# pOperation = 'Copy (or Move)';


# pUserName_Src = '';
# pUserName_Tgt = '';
# pRootFolder_Src = '';
# pRootFolder_Tgt = '';
# pClientsLoop = 'Tgt=Target user in de cloud';
# pOperation = 'Copy (or Move)';

Most recent code below.

Re: Transfer private objects from one user to another

Posted: Sat Jan 13, 2024 12:57 am
by Wim Gielis
Updated version below.

Re: Transfer private objects from one user to another

Posted: Sat Jan 13, 2024 12:21 pm
by gtonkin
👍

Re: Transfer private objects from one user to another

Posted: Fri Jan 19, 2024 5:29 pm
by jim wood
Thanks Wim. Very helpful

Re: Transfer private objects from one user to another

Posted: Sat Jan 20, 2024 1:43 pm
by Wim Gielis
You’re welcome Jim

Re: Transfer private objects from one user to another

Posted: Sat Jan 27, 2024 9:05 am
by Wim Gielis
I tried using TM1py and the TM1 REST API to achieve the same result.
We all know that the file system and ExecuteCommand will be out soon.

The solution suffers from being slow as well as that I cannot retrieve private application entries for a user.
Also, impersonation is also out in V12 I think so totally not sure how to proceed here.
Someone wants to give it a try as well ?

https://github.com/cubewise-code/tm1py/pull/1044

Re: Transfer private objects from one user to another

Posted: Sun Jan 28, 2024 8:05 pm
by Wim Gielis
As I am not really happy with my solutions in TI and the REST API, I loaded an idea / request for assistance.

https://ibm-data-and-ai.ideas.ibm.com/ideas/PAOC-I-1340

Feel free to give it your vote.

Re: Transfer private objects from one user to another

Posted: Sun Feb 25, 2024 9:02 am
by Wim Gielis
Updated version.
WG_CLOUD_transfer_private_objects.pro
(22 KiB) Downloaded 61 times
TECH_folder for output.pro
(6.35 KiB) Downloaded 58 times