Skip to main content
Solved

How to count the number of roles a user is assigned to using FME and the REST API?

  • November 30, 2022
  • 1 reply
  • 24 views

mgg_beca
Contributor
Forum|alt.badge.img+11

Hi there, I am trying to use FME to automate some user management for FME Server. Specifically I would like to schedule a workspace to remove any Azure users that are not members of a role. I have worked out how to list the users and get their roles, but I can't work out how to go from this json array: ["user:admin","fmeadmin","fmesuperuser"] to the integer value 2.

 

Can anyone please help me drop the "user:..." part from the array and count the number of items that are left over?

 

Thanks!

Marc

Best answer by mgg_beca

Nevermind, I adapted the answer from here: https://community.safe.com/s/question/0D54Q000080hL8CSAU/count-elements-in-json-array

 

changing it to: jn:size(fme:get-json-attribute("user_roles_json"))

 

Then I can just subtract 1 from the value to remove the "user:..." part which is always present.

 

Easy. Thanks @Takashi Iijima​ 

View original
Did this help you find an answer to your question?

1 reply

mgg_beca
Contributor
Forum|alt.badge.img+11
  • Author
  • Contributor
  • Best Answer
  • November 30, 2022

Nevermind, I adapted the answer from here: https://community.safe.com/s/question/0D54Q000080hL8CSAU/count-elements-in-json-array

 

changing it to: jn:size(fme:get-json-attribute("user_roles_json"))

 

Then I can just subtract 1 from the value to remove the "user:..." part which is always present.

 

Easy. Thanks @Takashi Iijima​ 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings