1

User Setting flag

Тема: User Setting flag

Hi Team,

I was trying to implement 'user setting flag' functionality in my application: https://sdk.wialon.com/wiki/en/sidebar/ … user_flags
After creation of a new user, the user is already provided with following access: enabled user, can change password and can change settings.
I need to enable "Can create objects/items" as well for every user created in the application. I tried using masks and flags as described in the documentation. But I am not clear about the concepts of masks and flags and was not able to get results. Could you please help with me an example to demonstrate how these things work? Any help will be really appreciated.

Thanks,
Jisna

2

User Setting flag

Re: User Setting flag

Hello jisnajoby03, the flagsMask parameters shows all flags you will operate with the request and in flags you need to put only flags that you enable. For example, when you create units it is Enabled and Can send SMS: options.
In order to add Can create objects and remove Can send SMS: you need to set flags in request as follows:
These two options go in flagsMask parameter:
0x04    Can create items
0x20    Can send SMS:
So it will be the sum of them converted in DEC: "flagsMask":36
In the flags value you need to put only the flag value that enable functionality.
Since we need to enable only Can create items, but Can send SMS should be removed, flags value will be 4.
"flags":4,"flagsMask":36

Also, you can find example description in documentation here -- https://sdk.wialon.com/wiki/en/sidebar/ … parameters
Similar tasks were also discussed in the following topics:
https://forum.wialon.com/viewtopic.php? … 62#p185362
https://forum.wialon.com/viewtopic.php?id=17469

Let me know if you have any additional questions.

Anton Zinovyev
Technical Care Engineer (L2)
Wialon
3

User Setting flag

(28/08/2023 20:42:13 отредактировано jisnajoby03)

Re: User Setting flag

Hello zant, Your response was helpful. I understand the concepts. Just want to confirm the following: In my application, every user created already have the following : "Can change password, Enabled, Can change settings" and each those users have not enabled, "Can create objects" and "Can send SMS" (Screenshot 1). I want to enable "Can create objects" for every user. In this case, I have set flags = 4 since "Can create objects" is the only one to be enabled. For this, I have set flagsMask=0 since I am not changing anything else. When I tried it was working fine(Screenshot 2). Could you please confirm whether this approach is correct?  Just want to confirm another scenario as well. I am not sure whether users created in CMS always have   "Can change password, Enabled, Can change settings" - options enabled as I mentioned my case earlier. Using these flag and mask values (flag =4, mask =0), will the option "Can create objects" get enabled in other those scenarios as well? Could you please help me with this?
Thanks

  • User Setting flag
  • User Setting flag
4

User Setting flag

Re: User Setting flag

jisnajoby03 hello, in general, your variant is correct, but usually, to set specific flag it should be specified in both parameters, e.g. "flags":4,"flagsMask":4

As for the initial properties. Yes, the indicated flags are default.
When the new unit is creating in Wialon via interface the system executes several requests for creation and then to set flags and other requests. You can check the steps from your side in browser development tool (Network tab) to see all the steps during the creation of new user.

Anton Zinovyev
Technical Care Engineer (L2)
Wialon