Page 1 of 1

Server Explorer Crash during security update

Posted: Mon Mar 07, 2016 10:08 am
by Ajay
Morning all,

I have experienced something of an oddity over the last few days in a very tried and trusted process of adding users to our system.

So, in a nutshell, I have a very small file of users to add to the TM1 instance, and before doing so, I clear out the }Clients dimension (except for administrators) and then load the users in.

The code in my Prolog is:

Code: Select all

iMaxNoClients = DIMSIZ ( '}Clients' ) ;

i = 1 ;

WHILE ( i <= iMaxNoClients ) ;

	sClient = DIMNM ( '}Clients', i ) ;

	IF ( sClient @<>'ADMIN'    %     CellGetS ( '}ClientGroups', sClient, 'ADMIN' ) @<> 'ADMIN' ) ;

		DeleteClient ( sClient ) ;

	ENDIF ;

	i = i + 1 ;

END ;

And then in my Metadata I have the following, used to add in the users:

Code: Select all

IF ( DIMIX ( '}Clients', vUser ) = 0 ) ;

	AddClient ( vUser ) ;

ENDIF ;

When I processed this, my Server Explorer session kicked me out and I could see that my process was still running in TM1Top, but was in an endless loop - so I have to crash the server and restart. Incidentally I am running this in IntegratedSecurityMode 1 at the moment.

Upon, hashing out the Prolog lines, the process works fine by adding the new users into the }Clients dimension......so it must be my prolog code.....my user id is in the admin group so I wasn't expecting to be booted out as my code is simply trying to remove clients who are not admins........any assistance to confirm my madness would be appreciated !!!

We are using 10.2.20200.55

Cheers Ajay

Re: Server Explorer Crash during security update

Posted: Mon Mar 07, 2016 10:30 am
by qml
Pretty sure you must not delete the Client under which you are running the TI. I know you are probably adding the Client back in Metadata, which would be fine for a regular dimension, but not for a security-related control dimension like }Clients.

Re: Server Explorer Crash during security update

Posted: Mon Mar 07, 2016 10:46 am
by Ajay
Hi Kamil

I am running the process at the moment, and I am an ADMIN, so I would have expected me to be fine, as the code should only remove clients who are not Admins.

That's what's causing me to loose more hair from my bald head ! :o

Ajay

Re: Server Explorer Crash during security update

Posted: Mon Mar 07, 2016 11:24 am
by qml
Ajay wrote:the code should only remove clients who are not Admins
That's not what your code is doing. If the first condition is met (i.e. Client is not ADMIN) then the deletion will still happen, even if the user belongs to the group ADMIN. Your OR (%) should be replaced with AND (&).

As a separate note, when you are removing dimension elements in a loop you should start from the end of the dim and decrement your counter, otherwise you are re-indexing the dimension with every deletion and skipping some elements as a result.

Re: Server Explorer Crash during security update

Posted: Mon Mar 07, 2016 11:39 am
by Ajay
Aaaaaaaaaaaargh !!!!!!!!

Good spot Kamil.....wouldn't it be nice in the next version to actually have the words "OR" and "AND" :roll:

Cheers for that Kamil... and have reversed the increment too.....now working as required.

Ajay