I currently have a table for users, a table for groups, and a table of items
every user has many groups
and every item has many groups that can access the item, and a list of groups that can not access the item
the criteria is the user needs to be in the privileged groups and NOT in the unprivileged groups in order to access the item.
How can I achieve that?
I tried to do a query to check for the list of allowed items for this user, and then select from the resulting list.
I am looking for the straight forward way and the best way to achieve the main goal without much unnecessary or inefficient steps
Related
When I want to list all the items in a Collection in my profile on the MongoDB website, it usually displays just one item and writes something like QUERY RESULTS 5-5 OF MANY above it (although there are 10 items in it), so I have to use arrows to cycle through the items. It's slowing me down when I want to change something about all the items, like maybe add a parameter or change the values.
Is there a way to get rid of that and see more items at the same time, listed in a column so I can edit them faster?
I am using the Firestore DB with a Flutter application.
In the application, I schedule employees to shifts for the following days.
As a feature, I want to implement a calendar that visualizes employee availability. When an employee is not assigned to a shift or not away he is available.
At the moment I have a collection of Shifts and Employees within Firebase. I was thinking of creating an Unavailability collection but on a second thought that might be unnecessary.
The question is, should I create an Unavailability collection within Firebase? Each document would have a property of date, employee name, and reason (employee already assigned, sick, vacation, etc.) Or implement this within the Employees collection which already exists. Within this collection, I have stored employee's attributes such as name, salary, email...
My concern with this is that for a given employee document, I will have an attribute with a very long list that contains the unavailability dates. Also, I would like to present the reason for the unavailability. This means I will have to present a shift with its details if the employee is already assigned to a shift or the general unavailability details.
Should I instead implement this within Flutter (3 collections for 1st case)?
Note: If it matters, I am using Bloc for the state management within Flutter.
I am trying to customize FusionPBX. In my dashboard, I want to list the incoming, placed and missed calls. I want to show this in two columns, one for 'Personal' Calls and the other for 'Ring Group' calls. I can't find any relation between xml_cdr and ring_groups table. How do I fetch the 'Ring Group' and 'Personal' calls from the xml_cdr table?
I wrote FusionPBX and I don't have a specific way to do what you are asking except call detail records will show ring_group_uuid when the call comes from a ring group. This may help accomplish what you need.
I have a JPAContainer filled with group entities (which contains properties like group name, number of users in the group, etc). I want users to be able to view a table containing a list of all the groups they belong to.
I got this to work by doing groups.addContainerFilter(new Like("users.email", user.getEmail())); (Just realized using their ID would have made more sense, but that's not the point), but now I'm having the issue where if there are two users viewing the table at the same time, the listed groups will change to the new user's groups.
For example:
Player A is viewing his groups
Player B goes to view his groups
Player A's view refreshes
Player A is now viewing player B's groups
I feel like I'm missing an obvious solution. I thought of just having a separate container backing the table, and then adding all the entities resulting from the filter on groups to the table's new container, but that seems inefficient.
Is it not possible to somehow have the same JPAContainer be filtered differently for different users?
Well, I decided to go with my first idea for a solution, and just add the groups to a separate container backing the table. If anyone has a better solution I'd love to hear it.
This is basically how I made it work:
BeanItemContainer<Group> tableBack = new BeanItemContainer<Group>(Group.class);
groupTable.setContainerDataSource(tableBack);
Filter loggedInFilter = GroupManager.getGroupsByUserFilter(UserManager.getLoggedInUser());
tableBack.addAll(GroupManager.applyFiltersGetResults(loggedInFilter));
Where applyFiltersGetResults() applies an array of filters to the JPAContainer and returns a list of all the groups matching them.
Edit: That was a bad solution. Originally I had a static JPAcontainer used for all UI instances, but now a new container is initialized per UI, which allows for filtering without affecting the container for others. I'd thought this wouldn't let people see other users, but it works fine.
I'm working on the design of a database for a client and they would like to work with one of their companies (customers) at a time throughout the entire session.
Ideally I would like to set up the forms so that they select the company to work with first and then can navigate to various other forms to manage the different aspects of that company (locations, departments, employees, etc.). There will obviously be many companies in the database, so I would need to ensure that they only see records for the selected company and adding new values ties them to the selected company.
I've been doing some searching around for how best to accomplish this but I've had no real luck.
Any guidance you can give would be awesome.
PS. I've got the structure of the database tables setup to ensure that any entity that is company-specific has a foreign key that identifies the company.
When the user enters the program, the first form they should see should be the company chooser form. Then the user can continue on to the other forms, which would all be filtered based on the user's initial selection.
You can either have the form write to a module-level variable, and all the forms would be filtered by the value of a function which would return the company ID to filter by.
It may be easier for you to simply hide the form, and filter all the successive forms by the value in the combo box of the hidden form.
You might also want to consider creating a query for each table, which contains only the filtered values per company (either with a function, or by the value of the hidden form) and basing all your forms/reports on those queries. That way you won't accidentally forget to include the filter in a form/report.