Tm1py: A Python script using tm1py to count/list users over TM1 servers on 1 admin host

Created on 15 Oct 2020  路  9Comments  路  Source: cubewise-code/tm1py

This is an enhancement to tm1py.

Describe what did you try to do with TM1py
I am converting a TI process into Python code using tm1py. Soon after starting, the functionalities in the new script surpass the functionalities of the TI script, with much less lines of coding.

Describe what's not working the way you expect
All functionalities in the script are working for now.

Version

  • TM1py 1.5.0
  • TM1 Server Version: 11.6
  • Python version 3.8.6

Additional context
All programming done on a local machine, but models that are used for testing are real TM1 production models. Only IntegratedSecurityMode = 1 for now. Other extensions include:

Code attached in plain text format
List TM1 users.txt

question

All 9 comments

Hi @wimgielis,

thanks for sharing!
I think it's be best to publish this script as a sample in the tm1py-samples repo.
https://github.com/cubewise-code/tm1py-samples

I think it would fit well into the Administration folder.
https://github.com/cubewise-code/tm1py-samples/tree/master/Administration

Once it's in the samples repo collaboration would be easier.

Perhaps some of the code you added to the script could also be integrated directly into the TM1py library.
Like the functionality you added to retrieve all read-only users, we could outsource into a function in the TM1py SecurityService I think.

Cheers,

Marius

Hi @MariusWirtz,

You're welcome. I just proposed a new file with the same coding, as it seems that uploading files is blocked for me.
As to outsourcing code, sure ! I'll leave it up to you decide, always happy to have a chat or discussion about what is useful. Feel free to brush up the code. It's far from awful but with experience in Python I guess things might be coded differently.

OK. I will brush up the code and upload it as a sample to the tm1py-samples project and outsource the pieces into TM1py that are generic enough.

Thanks in advance. In half an hour I am done with what I have foreseen for now, and I will look into the enhancements I listed in the coming days.

Latest code is here, I will not make changes for now.

List TM1 users.txt

I provided the code to use a descriptive attribute for }Clients element names, like }TM1_DefaultDisplayValue (or any other attribute). Other than that, the possibility to exclude TM1 models related to certain port numbers and various other small changes.

List TM1 users.txt

Hi @wimgielis,

I just started working on the script. I like the neat and tidy output it produces. Instead of integrating it into the existing tm1py-samples, I think it should be a GitHub project on it's own. It's already doing a lot more than any of the samples available and it has actualy practical value. The samples serve mostly as illustrations of how to do things.

You can create a GitHub repo easily like this:

image
The most difficult part is to come up with a name actually 馃檪

Once you published the script as a repository, I will create a merge request to include my changes.

Hi @MariusWirtz,

I guess the repository has been created and I added the latest version of the code:
https://github.com/wimgielis/Count-and-list-TM1-users/tree/main

Feel free to make changes and adjustments and extensions ! Let me know if I need to do something or you might want to discuss.

@wimgielis,

I added two functions to the SecurityService: get_custom_security_groups and get_read_only_users you can find the details here: ab89fe0fab042dbf37deffc43c46c8e1c65a62ff

Was this page helpful?
0 / 5 - 0 ratings