Permission based show/hide for every ui component/widget

Can anyone suggest me a way to set a conditional show/hide for every widget/UI component used based on permissions

I have a user model that has some “permissions” array

and I define permissions parameter with the list of required permissions to view this UI element

then somehow adopt this from a single place

ex.

view: ‘button’
label: ‘Add’
permissions: [‘add_item’]

and have a code somewhere in app.js
to control

if item.permissions !== undefined and !user_has_permission(item.permissions)
item.hide()

can’t find a way to attach this to every view

ктонить? приходится писать не красивые конструкции в каждом виджете …

You can use webix.ui.each to iterate through all UI elements on the page and hide the unwanted elements.

Something similar to the next

http://webix.com/snippet/3b99911c

WOW! thanks
that will help

Team, I want to iterate through all UI elements depends on the response that is dynamically returned from the service call. But here the ui elements are loaded before the service returns the response. I need to apply the permission based on the response only. please help me on this…

@Bharathiraja ,
To search views and iterate through them is possible with using queryView
https://snippet.webix.com/ggjmm4dy

Also, I can say that the webix.ui.views is an object which stores all initialized (i.e. currently existing) views including windows ( ID of a view is used as a key ): https://snippet.webix.com/rj4h47vc