Element Locking and Unlocking (Non Admin Group)

Post Reply
sameer
Posts: 4
Joined: Fri May 07, 2010 2:14 am
OLAP Product: TM1, Planning Analytics
Version: 9, 10, PA, CX
Excel Version: 2010 2013 2016

Element Locking and Unlocking (Non Admin Group)

Post by sameer »

Hi

User 1 (Non Admin) - Locks Element "A" in the dimension "XYZ"
User 2 (Non Admin) - Tries to Unlock the element "A" in dimension "XYZ" (this user has got Admin Access to element "A") - Unable to UnLock - Why?

User 2 has got Admin access to the dimension "XYZ" (which holds the Element "A") as well. Also tried giving user 2 Admin Access to the }ElementProperties_XYZ cube - Still No Luck

As an Admin I can unlock the element "A" - which is fine, cauz Im under the Admin Group

Would appreciate if anyone tried the above scenario and were successfull. Thanks
User avatar
Steve Rowe
Site Admin
Posts: 2423
Joined: Wed May 14, 2008 4:25 pm
OLAP Product: TM1
Version: TM1 v6,v7,v8,v9,v10,v11+PAW
Excel Version: Nearly all of them

Re: Element Locking and Unlocking (Non Admin Group)

Post by Steve Rowe »

Have you tried the lock and reserve security groups for user B?

also

I think only the person that locks the element can unlock it?

I think the documentation may be incorrect too, I'm pretty sure that even full admins cannot edit locked data, which is not what the docs state
TM1 Developers Guide 9.5.1
"When a user locks an element, only those users who have Admin rights for that element can update the data that it identifies. Even the user who locks the element cannot update its data, unless they have Admin rights for that element."
I don't think the above from the docs is correct? Don't have a lot to do with security tbh so could be wrong....

Cheers
Technical Director
www.infocat.co.uk
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Element Locking and Unlocking (Non Admin Group)

Post by lotsaram »

The docs are definitively wrong on this one. The primary reason that we use locking is that it means NO ONE can edit data, including admins, including TI.

However in relation to the question from the OP the way we use it is that users only ever have write access and all the locking is done by admins and in this scenario any admin can unlock regardless of who did the locking. Providing the user has admin rights to the particular object I would have thought this would hold true for non admins as well but by the sounds of it maybe it doesn't.
sameer
Posts: 4
Joined: Fri May 07, 2010 2:14 am
OLAP Product: TM1, Planning Analytics
Version: 9, 10, PA, CX
Excel Version: 2010 2013 2016

Re: Element Locking and Unlocking (Non Admin Group)

Post by sameer »

Manage to do a trick to overcome this. Assign user 2 to the Admin group and then Unlock the element and then remove the user from the Admin group.. Worked for me... ;)



CubeLockOverride(1) ;
nChangeStatus = 0 ;

sCheckGroup = CellGetS( '}ClientGroups' , 'User 2' , 'Group' ) ;

IF( sCheckGroup @= 'ADMIN' );
ELSE;
AssignClientToGroup( 'User 2' , 'Admin' );
dChangeStatus = 1 ;
ENDIF;


cCubeName = '}elementproperties_XYZ' ;
cEleName = 'A' ;

CellPutS( '' , cCubeName , cEleName, 'lock' ) ;

IF( dChangeStatus = 1 );
RemoveClientFromGroup( 'User 2' , 'Admin' );
ENDIF;
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Element Locking and Unlocking (Non Admin Group)

Post by lotsaram »

Hi Sameer - I would be REALLY surprised if the code you provided works! The reason being that when an element is locked that this applies also to the intersection of LOCK and the element in the }ElementProperties_Dimension cube which means that the cell is not writeable even by a member of the admin group. the element must be unlocked before the blank value can be sent, it is what you might call a "Catch 22" situation. (Possibly you tested when the element "A" was not actualy locked.) Also as the TI process is already running with admin rights regardless of who kicked off the process adding and removing a user to the admin group within the prolog doesn't actually achieve anything.

The only OOTB method TM1 gives to unlock is via the subset editor GUI in the right-click > security menu. In theory you could do a roll your own programatic way via the API but it would not be an easy route.

Using CellPutS to write to the }ElementProperties_Dimension cube to lock an element on the other hand works just fine. it is only the unlocking that is the problem.
John Hammond
Community Contributor
Posts: 295
Joined: Mon Mar 23, 2009 10:50 am
OLAP Product: PAW/PAX 2.0.72 Perspectives
Version: TM1 Server 11.8.003
Excel Version: 365 and 2016
Location: South London

Re: Element Locking and Unlocking (Non Admin Group)

Post by John Hammond »

Lotsaram

It's the CubeLockOverride(1) that does the trick of allowing a TI to run above its normal Admin level and unlock cubes. This gives you a programmatic method to unlock without resorting to the API.

John
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Element Locking and Unlocking (Non Admin Group)

Post by lotsaram »

John Hammond wrote:Lotsaram

It's the CubeLockOverride(1) that does the trick of allowing a TI to run above its normal Admin level and unlock cubes. This gives you a programmatic method to unlock without resorting to the API.

John
Hmmm, I missed that.

But_this_would_be_an_undocumented_function ! :evil:
I can find it in the 9.5.2 documentation in the list of reserved words but nowhere else.

I like it. It means it is possible to provide a simple TI programmatic interface to unlock as well as lock elements which can be very helpful in certain situations. What I do not like is the fact that the function is undocumented.

@Sameer as per what john has highlighted it is CubeLockOverride that is your secret sauce here. You can remove the adding and removing the user from Admin group, as this isn't doing anything useful.
User avatar
qml
MVP
Posts: 1094
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: Element Locking and Unlocking (Non Admin Group)

Post by qml »

@lotsa, but of course it's documented! ;)

In the Iboglix style it's documented in the release notes.
Kamil Arendt
lotsaram
MVP
Posts: 3667
Joined: Fri Mar 13, 2009 11:14 am
OLAP Product: TableManager1
Version: PA 2.0.x
Excel Version: Office 365
Location: Switzerland

Re: Element Locking and Unlocking (Non Admin Group)

Post by lotsaram »

qml wrote:@lotsa, but of course it's documented! ;)

In the Iboglix style it's documented in the release notes.
Thanks. How obtuse of me not to have noticed.

Interestingly the function (as per the 8.4.5 release notes - thanks for the link ;) ) is supposed to override cube locks but it would also appear to override element locks as well. Therefore one suspects that the mechanism by which this works just "peels off" the additional layer of locking which behaves like an extra layer on top of standard security (but as this behavior is undocumented who knows, that's just wild speculation on my part.)
sameer
Posts: 4
Joined: Fri May 07, 2010 2:14 am
OLAP Product: TM1, Planning Analytics
Version: 9, 10, PA, CX
Excel Version: 2010 2013 2016

Re: Element Locking and Unlocking (Non Admin Group)

Post by sameer »

@Lotsaram - I tired without assigning the user to the Admin group - It doesn't work. It manages to clear the cell but for some reason it continues to be greyed out.
so having both the CubeLockOverride function and assigning/removing user from the Admin group seems to be the only solution I have at the moment.
ruchika512
Posts: 5
Joined: Fri Dec 20, 2013 11:06 am
OLAP Product: Tm1
Version: 10.2
Excel Version: 2007

Re: Element Locking and Unlocking (Non Admin Group)

Post by ruchika512 »

Hi
I am facing the similar issue with 10.2.1, when trying to unlock the cube with a normal user.
Also Provided the Admin access to the user on that cube,. still its not working.
Its able to execute the below command
CellPutS( '' , cCubeName , cEleName, 'lock' ) ;
Means reset the Lock to blank. But cube is still in locked status.
also when I tried to use the suggestions provied above.i.e.
CubeLockOverride(1) ;
and assigning the user to ADMIN group the process is failing at AssignClientToGroup( 'User 2' , 'Admin' );
Not enough privilegs to execute this function.
Any help would be appreciated.
Thanks!
declanr
MVP
Posts: 1817
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: Element Locking and Unlocking (Non Admin Group)

Post by declanr »

ruchika512 wrote: Not enough privilegs to execute this function.
Any help would be appreciated.
Thanks!
When you are using any security based function and the process is being run by someone who is not an admin at the start of the process you need to right-click on the TI in question and select security access; this allows it to be run with elevated levels of access.
Declan Rodger
Post Reply