AssignClientToGroup() after AddClient()

Post Reply
maps
Posts: 43
Joined: Wed Aug 10, 2011 9:21 am
OLAP Product: TM1
Version: 9.4.1 and 9.5.1
Excel Version: 2003

AssignClientToGroup() after AddClient()

Post by maps »

Hi guys,

I just tried to create a excel sheet where a admin kann add new users to the system. Via a action button a process gets startet which adds the new user, psw and adds him to Groups.

To add the user works perfectly. But the Groups are not added automatically. But when I run the process a second time it works. here is the code of the process.
Proglog:

Code: Select all

AddClient(clientname);
AssignClientPassword(clientname, psw);

AssignClientToGroup(clientname, group1);
AssignClientToGroup(clientname, group2);
AssignClientToGroup(clientname, group3);
AssignClientToGroup(clientname, group4);
...
Because it didn't work I added some SecurityRefresh-statements but it didn't effect the process. The problem remains...

Code: Select all

AddClient(clientname);
AssignClientPassword(clientname, psw);

SecurityRefresh;

AssignClientToGroup(clientname, group1);
AssignClientToGroup(clientname, group2);
AssignClientToGroup(clientname, group3);
AssignClientToGroup(clientname, group4);
...

SecurityRefresh;

Any ideas?
rmackenzie
MVP
Posts: 733
Joined: Wed May 14, 2008 11:06 pm

Re: AssignClientToGroup() after AddClient()

Post by rmackenzie »

I think you should try splitting the statements between the Prolog and the Epilog. This is because TM1 will not commit metadata changes until the end of the script block. You can't perform a function on the new client because the change hasn't been committed to the }Clients dimension. It is the same thing as if you were creating a new dimension element and then trying to CellPut against it in the Prolog. The reason it works the second time is because the new client already exists so the 'commit problem' is no longer an issue and the permission is simply set against an existing client (or the cellput is performed against an intersection including existing elements).

Also, I think you only need the one SecurityRefresh statement.

Prolog:

Code: Select all

AddClient(clientname);
Epilog:

Code: Select all

AssignClientPassword(clientname, psw);
AssignClientToGroup(clientname, group1);
AssignClientToGroup(clientname, group2);
AssignClientToGroup(clientname, group3);
AssignClientToGroup(clientname, group4);
SecurityRefresh;
Robin Mackenzie
maps
Posts: 43
Joined: Wed Aug 10, 2011 9:21 am
OLAP Product: TM1
Version: 9.4.1 and 9.5.1
Excel Version: 2003

Re: AssignClientToGroup() after AddClient()

Post by maps »

Thanks a lot for your help. It works now!
LutherPaul
Posts: 80
Joined: Tue Jun 04, 2013 3:35 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: AssignClientToGroup() after AddClient()

Post by LutherPaul »

Hi All,
How do we assign Maximum ports and unique ID thru script?
We are using 9.5.2.

Thanks,
Luther.
declanr
MVP
Posts: 1831
Joined: Mon Dec 05, 2011 11:51 am
OLAP Product: Cognos TM1
Version: PA2.0 and most of the old ones
Excel Version: All of em
Location: Manchester, United Kingdom
Contact:

Re: AssignClientToGroup() after AddClient()

Post by declanr »

LutherPaul wrote:Hi All,
How do we assign Maximum ports and unique ID thru script?
We are using 9.5.2.

Thanks,
Luther.
Take a look at the }ClientProperties cube.
Declan Rodger
LutherPaul
Posts: 80
Joined: Tue Jun 04, 2013 3:35 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: AssignClientToGroup() after AddClient()

Post by LutherPaul »

Thanks for the reply Declan.

I am looking for a script as I want to automate the process.

Thanks,
Luther.
User avatar
qml
MVP
Posts: 1098
Joined: Mon Feb 01, 2010 1:01 pm
OLAP Product: TM1 / Planning Analytics
Version: 2.0.9 and all previous
Excel Version: 2007 - 2016
Location: London, UK, Europe

Re: AssignClientToGroup() after AddClient()

Post by qml »

LutherPaul, the code to do what you need is not very complicated. You have received help from declanr, this should be enough to get you started. Try writing this script yourself and when you run into any specific issues, you can always come back for more help. No-one here will write this code for you, especially with your attitude.
Kamil Arendt
LutherPaul
Posts: 80
Joined: Tue Jun 04, 2013 3:35 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: AssignClientToGroup() after AddClient()

Post by LutherPaul »

Thanks QML for pointing out. Did not know I was showing attitude.
I will try to write better.

Thanks,
Luther.
Darkhorse
Posts: 141
Joined: Wed Mar 09, 2011 1:25 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2003 2007 2010 2013

Re: AssignClientToGroup() after AddClient()

Post by Darkhorse »

Hi Luther

I came across the same issue I believe your facing, your TI won't commit,

You need to right click on the TI before opening it and click on security setting its a tick option, this will then allow your TI to write to port settings,
LutherPaul
Posts: 80
Joined: Tue Jun 04, 2013 3:35 pm
OLAP Product: TM1
Version: 10.2.2
Excel Version: 2010

Re: AssignClientToGroup() after AddClient()

Post by LutherPaul »

Thanks Darkhorse!

We clould easily set these without a big program.
CellPutS('MyPwd@0123','}ClientProperties', vClientName , 'UniqueId');

Luther.
Post Reply