1

Read/edit User Properties

Topic: Read/edit User Properties

Hi there,

We would like to read/edit user properties. Currently we are able to edit using the update api call(user/update_user_flags) , but we cannot read existing prechecked property items for a specific user. For example in the screenshot blow, we would like to see that user Arsalan Qayum has Can Create Items Enabled, Can Change Password Enabled, Can Send SMS Disabled, User Account Enabled, Can Change Settings Enabled.

We want to show these same prechecked property items in our web application. Thanks

  • Read/edit User Properties
2

Read/edit User Properties

Re: Read/edit User Properties

Hi Arsalan,

To get information about these flags you need to get user via search item requests with flags = 256 which returns Other properties
Other properties contain parameter "fl" which shows prechecked property items as on screenshot

Diana Cheley
Wialon Hosting Expert
Gurtam
3

Read/edit User Properties

(edited by arsalanqayum332 17/06/2021 10:31:02)

Re: Read/edit User Properties

Hi Chdi,

Your response was helpful, however we still have some lingering confusion.

I am able to get “fl” parameter shown in the screenshot given below. But we still need to reverse that one single digit value and check the checkbox permission properties which are more than just one we need to convert.

I am attaching a screenshot showing the "fl" value.

I am hoping if your team can suggest way to reverse engineer “fl” value. We’re at a stalemate here in trying to code this portion of our application.    

Sincerely we appreciate any help,

  • Read/edit User Properties
4

Read/edit User Properties

Re: Read/edit User Properties

Hi Arsalan,

When you get the 'fl' value you just need to check each bit status - 0 or 1. Depend on bitN value  0 or 1 it will be means the option status

1 bit  = 1 -     User disabled,  0  - User active
2 bit =1  -  Can't change password , 0 - can change password
3  bit  = 1 - Can create items, 0 - cannot create items
5 bit = 1 -     Can't change settings,  0 - can change settings
6 bit  = 1 -  Can send SMS,  0 - cannot send sms

In your example fl = 21 = 10101   which means
1 bit  = 1 -     User disabled
2 bit = 0 - can change password
3 bit = 1 - can create items
5 bit = 1 -     Can't change settings
6 bit = 0 - cannot send sms

The same as on screeshot

When you need to change settings, you just sum up or not the required values (decimal)
For example,  enable user (=0) + cannot change password (=2) + cannot create items (0) + Can change settings (=0) + Cannot send SMS (0) = 2
or User disabled (=1) + can change password(=0) +can create items(=4) + Can't change settings(=16) + cannot send sms(=0) = 21

Diana Cheley
Wialon Hosting Expert
Gurtam
5

Read/edit User Properties

(edited by arsalanqayum332 17/06/2021 10:30:51)

Re: Read/edit User Properties

Hi Chdi,

Thank you for the support, we’re still stuck on this topic. Please review my findings.

What I understand is.
If we want to check variable "Can Change password" which have mask value 2.
Mask value 2 will mean we are interacting with "Can change password" and flag value will be either 0 or 1, same logic applies to other variables. But it still fails and does not work for all scenarios.

If we want to check option "Can Change Settings" which have mask value 16.
Mask value 16 will mean we are interacting with "Can change Settings" and flag value will be either 0 or 1, same logic applies to other variables. But it still fails and does not work for all scenarios.

For example:
When you get the 'fl' value you just need to check each bit status - 0 or 1. Depend on bitN value  0 or 1 it will be mean the option status of:

1 bit  = 1 -     User disabled,  0  - User active
2 bit =1  -  Can't change password , 0 - can change password
3  bit  = 1 - Can create items, 0 - cannot create items
5 bit = 1 -     Can't change settings,  0 - can change settings
6 bit  = 1 -  Can send SMS,  0 - cannot send sms

In your example fl = 21 = 10101   which equates to:
1 bit  = 1 -     User disabled
2 bit = 0 - can change password
3 bit = 1 - can create items
5 bit = 1 -     Can't change settings
6 bit = 0 - cannot send sms

The way fl = 21 =  10101 binary you are mapping also does not seems to work. It works if we have following sequence/order.

In your example fl = 21 = 10101   which equates to:
1 bit  = 1 -     User disabled
2 bit = 0 - can change password
3 bit = 1 - can create items
5 bit = 0 - cannot send sms
6 bit = 1 -     Can't change settings

Also sequence we have in Wialon CMS dashboard is different.

Please Note:

There are scenarios in we have falgs value 32. And 32 = 100000, which are actually 7 bits, and we have 6 bits to take care and in some cases we have flag 4 = 0100 or 5 = 0101 which are 4 bit values and in your example we have 5 bits to take care each time. 

Maybe go further into detail I’m not sure how to figure this algo out on my end.

Sincerely we appreciate any help,

6

Read/edit User Properties

Re: Read/edit User Properties

Hello Arslan!

I have answered here https://forum.gurtam.com/viewtopic.php? … 27#p185527
Please look it, hope it's clear.
If you have some additional questions, let continue at that topic.

Diana Cheley
Wialon Hosting Expert
Gurtam
7

Read/edit User Properties

(edited by arsalanqayum332 17/06/2021 10:25:33)

Re: Read/edit User Properties

Hi Chdi,

Thank you so much for the details over the other ticket. That helped me to understand.

Regarding this ticket, one thing I would like to confirm in this ticket is.

We have total 8 bits values, and have 5 bits values for example given below as 21 binary is 10101.

Flag value "fl"  = 21 = 10101  which equates to:

1 bit  = 1 -     User disabled
2 bit = 0 - can change password
3 bit = 1 - can create items
5 bit = 1 -     Can't change settings
6 bit = 0 - cannot send sms

And

1 bit  = 1 -     User disabled,  0  - User active
2 bit =1  -  Can't change password , 0 - can change password
3  bit  = 1 - Can create items, 0 - cannot create items
5 bit = 1 -     Can't change settings,  0 - can change settings
6 bit  = 1 -  Can send SMS,  0 - cannot send sms

In the example above we do not have any 4 bit value to work with any of user properties, so we can skip 4th bit value when mapping. Now our mapping will look like something given below (considering we have 8 bits total)

Flag value "fl"  = 21 = 10101  which equates to:
which actually will be
fl = 21 = 00010101
And when mapping from right to left, we can skip 4th bit as none of user properties are 4 bit. (We have 1bit, 2bit, 3bit, 5bit, 6bit)

Skipping/excluding the the 4th bit and map 00010101

1 bit  = 1 -     User disabled
2 bit = 0 - can change password
3 bit = 1 - can create items
5 bit = 1 -     Can't change settings
6 bit = 0 - cannot send sms

Please give my findings and understanding a green single, so I be assured about it.

Best Regards

8

Read/edit User Properties

Re: Read/edit User Properties

Hello Arslan!

you are correct, the 4th bit is not used for user settings, so there is always 0 in this user's flag.

Diana Cheley
Wialon Hosting Expert
Gurtam
9

Read/edit User Properties

(edited by arsalanqayum332 17/06/2021 10:25:44)

Re: Read/edit User Properties

Hi Chdi,

Thank you for confirming. 

Best Regards

10

Read/edit User Properties

Re: Read/edit User Properties

Hi how to add galileo v7x and adding rs485 to wialon because I add but sensor don't read fuel

11

Read/edit User Properties

Re: Read/edit User Properties

oscarkitomari wrote:

Hi how to add galileo v7x and adding rs485 to wialon because I add but sensor don't read fuel

Please write your request here in new topic - https://forum.gurtam.com/viewforum.php?id=18

Diana Cheley
Wialon Hosting Expert
Gurtam