简体   繁体   中英

filter records using UserId of currently logged in user

I have got an application where by a user can add other lists of Staff with his user ID.
I have roles where by if one is in role of staff, when logged in he can see also list of what was added by other staff.
What I need to do filter what each staff will see in a drop-down, ie Each should only view the records he added according to his ID.
How I like to do it is check the user Id of currently logged in user, and only let him view his records which are being populated in a drop-down combo-box.

Suggestions about this appreciated

While adding other Staff, you need to store also that who created this staff.

Now, when data for the dropdown is fetched, also get the CREATED_BY attribute of the dropdown. Say, you get the value of the dropdown and text field of the dropdown. In your textfield, it will be the your staff names and in your value field it will be your dropdwon value and CREATED_BY field separated by a splitter(eg: ~ or :) Now, loop in the value by splitting it where 0th item is your dropdown value and 1th item is CREATED_BY attribute.

Compare it with the logged in user id and display what you require.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM