8 – Can a function be executed on a user object in Twig?

You can use hook_entity_load to add fields to the user object as follows:

Function mymodule_entity_load ($ entity, $ type)
if ($ type == & # 39; user & # 39;
foreach ($ entity as $ e) {
$ e-> myField = & # 39; hello & # 39 ;;

Then I can do that in the branch:

{{}} User.myField

That's useful, but it would be great if I could do that:

{{user.getActivity ()}}

Or more precisely:


    {% for activity in user.getActivity ()%}
  • {{}} Activity.time
  • {% endfor%}

Is there a way to add a "function" this way?

Authentication – How to check if a user can see GUI elements without having to query the microservice each time?

I am trying to find a way to check if the user has permission to view a restricted area without having to request the server each time.

At the moment I have the following idea:

Authentication and Authorization with JWT

For the flowchart I have the following questions:

  1. Should the news service be a additional signed tokenthat contains permissions / roles for the message service?
  2. Reissue the existing JWT and include permissions as well as message service-wide roles?
  3. Issue a server-side request that tells the user if they can see a particular GUI.

Which of the ways to store and retrieve microservices (based on accessLevel) most meaningful?

Since the user may be able to change the JWT or additional token and see the restricted GUI (since they are not checked on the client side), the worst may be that the user issues server requests that are not executed because the user does not have the permission has the ability to perform the action as soon as the server side is active.

To edit: I tried to simplify the question and focus on one topic.

Ease of Use – UX Benchmarking: How Many Details Should a User Collect in a Business Product?

It is very valuable to collect benchmark data about a user's experience over time. The problem we come across is how much information we should ask our user to make informed decisions from the data we collect. We are working on a corporate product with many different functions in many different areas of the product. So I am not sure how much data beyond our few KPIs should be queried by our users when asked "Do you want to give feedback?" The survey model is displayed for the different types of users using the many different areas in the system. Does it make sense to create a system-wide benchmark without capturing the area where the user is most likely or most frequently used, as we capture the benchmark data in more detail for each feature of the product?

The concern is what we do with the data we collect from a user we do not know much about – the user could use multiple parts of the system and we can do some analysis, but there would be a lot of assumptions. Has anyone working on a company product collected benchmark data that could convey insights?

8 – How can I load a Commerce Store by User ID?

I am building a multi-seller commerce site where a user can register and sell their product. I need to display a menu link if the user is anonymous to become a "seller", where he is directed to sign up and create a business form.

When the user is logged in, I want to display a menu link that displays "My Store" if he has previously created a store. How can I load a store from the user ID to see if it has a store?

I could not find an example where someone can load a user's shop.

User Tracking – Is VISA Gift Cards Not Traceable?

A) Yes, they are tracking the purchases. Almost all prepaid gift cards require a registration that collects different data about you: name, address, zip code, phone number, etc.

B) It will. The gift card becomes an account and you can view your purchase history just like a regular credit card.

However, you can be a liar by activating the card and entering incorrect information. You can go to a fairly distant business or a very busy shop (my local pharmacy is always full). You can also pay in cash, which means you have no credit card company records to associate with your identity. And if you're smart with your purchases (do not try to order medicines to your home), they can not get information from the merchant.

tl; dr: If you have cash, avoid most of the tracking. When you lie to the company, it's very easy to dodge the ID.

Restrict user frontend read access to posts from specific categories

I know there are a lot of plugins that you can use to restrict access to content, but for some reason I can not find anything that suits my case.

All users on my site are registered as subscribers. I need to be able to switch to the profiles of each user and select one or more categories.

After updating, the user should only be able to read posts in the front-end of the selected category (s).

Who knows how I can achieve this.

Which user permissions are needed to access (read) operating attributes in openldap?

I am currently configuring an Openldap server. To define user permissions, I use an ldif file. To check permissions and see if everything works as expected, I use Apache Directory Studio.

A prerequisite for user permissions is that a user can read his own entry, a local administrator can read all user entries in his store, and a "global" administrator can read all user entries. So far everything works so well.

In addition, I need to know which groups a user belongs to. For that I wanted to use the operating attribute member of this is supported by openldap. Unfortunately, only the "global" administrator can see the operational attributes. When I try to retrieve operational attributes in Apache Directory Studio with a local administrator or a simple user, no operational attribute is displayed / retrieved.

I tried to give these users read permission for all member attributes that use their DNS with the following rule:

olcAccess: to attrs = member, entry
from dnattr = member selfwrite
from * break

This rule is similar to the one at the end of the openldap documentation, chapter 8.3.5. This does not seem to work at all, so I've tried to add a general rule for accessing the role entries:

olcAccess: to dn.regex = "ou = roles, dc = ([^,]+), dc = customer, dc = domain, dc = de $ "attrs = entry, @ groupOfNames, children
by group.expand = "cn = Administrators, ou = roles, dc = $ 1, dc = customers, dc = domain, dc = de" write
by group.expand = "cn = ProductionUser, ou = roles, dc = $ 1, dc = customers, dc = domain, dc = de"
by group.expand = "cn = test user, ou = roles, dc = $ 1, dc = customer, dc = domain, dc = de" read
from * break

This rule allows each user to read all role entries for their store. The operating attributes or at least member of will still not be visible to the users.

So, what permissions do I have to grant so that every user can read at least those member ofAttribute for a separate entry?

User expectation – Can a toggle switch appear?

Unless it is a confirmation pop-up (which should be avoided as users tend to clear it out without reading the message), the answer is no.

I have to say that I think about a switch as a toggle. A switch activates or deactivates a point. I doubt that a user with a switch would expect anything else. When it triggers a modal screen, the switch is no longer accessible. Therefore, the user would have to find a way to get rid of the modal to turn off the option. That would be funny.
Without a more concrete context (what problem do you want to solve), it is difficult to give advice or examples of other solutions. Something that comes to my mind is to show or hide something below the switch rather than a modal. This would work with the mental model of a switch.