Dynamic querying of translated keywords - tridion

I'm trying to use the dynamic query api to determine if components are available in Tridion based upon a users audience manager profile.
One of these fields in their profile is 'Country' - which is recorded as free text in the extended details part of the audience manager profile, but based on a keyword from a 'Countries' category. We cannot store it as a keyword unfortunately due to client requirements.
It's expected that certain forms on the website being developed will be pre-filled using profile information from audience manager, for example pre-selecting a users country from a dropdown menu.
My concern is that if the 'Countries' category is translated in another publication, it would be impossible to pre-populate countries dropdown menus on forms because of the translated country names would be different.
Is that the case, or is it possible to translate and audience manager profile as well?

If you can get the local keyword (the Chinese one in your example). From there you can do a "Using Items" look up to find the Parent Keyword. I don't have the specific code, but if you check in the GUI, you can see the parent in the Used Items tab if you do a Where Used on the localised Keyword.

I don't know how specific this is to Audience manager. Isn't it more of a general blueprinting question? As you say, if you translate the country names keywords, the translated values are, of course, what will be published to the content delivery system. It may make sense to use the translated values in your site; otherwise why would you translate them?
If there are good reasons for wanting to use the untranslated values, then you can easily do this by publishing also from the parent publication, and writing your queries to operate in the context of that publication. As you have both values available, you can build your programme logic to make use of whichever one makes sense, and still have the benefit of a clear relationship between the two.

Related

Single multi-tenanted firestore or many single tenanted firestores?

I'm building a SaaS system that allows users to define their own data models and enter data according to those models. It's a bit like airtable.
One user might model a bookshop, and would have a Book model, with title and ISBN fields. Another user might model medical records, and would have "date of last visit" as a field.
In the case of the bookshop, I want users to be able to search on title and ISBN. In the case of the medical records, I want users to be able to search on the date of the last visit.
I am using Firestore as my backend.
Firestore requires an index to enable a search. So that approach will not scale as # of customers increases.
My thought therefore was to have a Firestore instance for each customer, and those specific instances would have the necessary indexes.
I'm sure there are downsides to doing this though.
What would folks recommend to best solve this need?
What you are trying to achieve is some kind of weird, since you will not provide at least a few standard common properties for each user of your Bookshop.
When you want to perform a search in a Cloud Firestore database, you need the exact name of the property on which you want to search for. Having dynamic properties might not help you solve the search feature. However, you can create a document with a property of type array that can hold the name of all properties the users have chosen and perform a search on every property, but this solution will be much too expensive.
In my opinion, a possible solution might be to create at least a few common properties, so you can have the properties on which you can search. When someone creates, for example, a book shop you can display at the beginning all available properties a user can choose. Once you create a shop, you can have different users with different shop properties. This means that if a user does not choose a property, when you perform a search on that property, the results won't contain his/her products. This will work, only if you have predefined properties.

How can I allow the Current User to have permissions/views tied to their Direct Reports and Manager relationships?

In a handful of circumstances, I'd like to allow the Current User to be able view a list of records filtered by Owners of each record that are Direct Reports that they manage or even by the Manager they report to via our global directory.
I'm comfortable making a new Datasource for CurrentUser in a Directory model. However, I'm tripping over myself trying to find the best way to match an Ownership (email) field from a record, with an array of the direct reports associated with the current user.
A specific example would be on the Travel Approval template. The table on the Dashboard page has a filter for "My Requests | All" and I'd love to add a third option for "Direct Report Requests".
My assumption is that I would adjust the onClick event to filter results accordingly:
widget.datasource.query.pageIndex = 1;
widget.datasource.query.filters.Owner._equals = app.user.email;
widget.datasource.query.filters.Owner._in = null;
widget.datasource.load();
updateUrlForDashboard();
That's one small example, but more importantly, I'd like to get a better understanding of how best to reference/store those additional relationships about the Current User.
Ideally, a current user is able to have greater ability to manage (approve/deny/comment on) resources tied to their Direct Reports and generate records that provide a similar level of control to the Users that Manage them.
I'm not sure if that's best handle by some use of Roles or another approach. Any advice on how best to plan out that kind of setup would be much appreciated.
funny thing ... I had the same question a couple of months ago. I think you will find Pavel's solution on this very interesting. You can find it here.

Drupal 7 - Functionality for multi-select of nodes and then action to send email to a manually entered email address

I have a webform setup along with a rule that creates a new content type called 'Idea' with most of the submitted data (so that comments can be made on node of type 'Idea')
The webform is for new ideas for the business and depending on the idea it then needs emailed to the correct person in the business so they can respond.
I know a way of doing this would be to create a drop-down list in the webform and assign an email address to that record (eg. IT > (email would go to > it.dave#company.com) but they don't want it to be in the control of the user in case they select the wrong person for the webform submission to go to, they want to be able to manage this themselves manually.
What is the best way to approach this?
I was thinking, is there some sort of multi-select option where you could select one or multiple nodes from the content page and then manually enter an email address, hit a submit button, which emails them.
They want to be able to enter the email part manually and not choose from a list as it may end up going to a large range of different people, not one of a pre-determined list.
I was possibly thinking if rules or workflow or workbench might help but never used the last 2 before, but if someone knows of a way that might be best to approach this it would be appreciated.
Step 1
Use the Rules module to create a Rules Component, which includes whatever Rules Conditions you might need (if any), and with a Rules Action to Send an eMail, for each of those fields you want to be updated.
Step 2
Create a view of the group of nodes for which those eMails should be generated. Then transform that view into a view that uses Views Bulk Operations, and use the technique documented in "How to use Rules to create a custom bulk operation for a VBO view?". In doing so, you'll then be able to use the Rules Component from Step 1.
Tutorial
To get the idea, have a look at the video about Using Rules components with VBO" which uses a Rules Component with (only) 1 parameter. If you want even more, then also watch the subsequent "Using Rules components with more than one parameter" video.
Attention: to process like 100.000 entities at once is quite a challenge (memory requirements, etc). Therefor you might want to also watch the video about "More details about VBO settings" ... Before you are tempted to use VBO for processing them all at once ...

Migrate Plone users and groups to relational data

I have a Plone 4 site which contains a lot of users and groups which are stored in the ZODB. Over time, we added some functionality which uses relational data (in a PostgreSQL database); some tables have fields which contain user or group ids.
However, currently the users and groups are defined in ZODB rather than the RDB, so we don't have proper foreign keys here. Thus, the obvious idea is to migrate the user and groups data to the RDB - those who/which are used by the Plone site, at least; I assume emergency users need to be an exception to this (but those are no members of any groups anyway).
Would this be a good thing to do?
Are there reasons to do it only partly, or should I transfer everything including group memberships? (Since memberships are stored as lists of users (and/or groups) with the containing group, I could imagine a reverse table which holds all groups a user is member of, and which is maintained by a trigger function.)
Are there any special tools to use?
Thank you!
imho it's based on what you want to achieve. In Plone you have PAS, so technically it doesn't really matter, where you put users, groups and user group relationships.
You can store users/groups in:
Plone (by default)
SQL - pas.plugins.sqlalchemy
LDAP/AD - Products.PloneLDAP
There are also many other plugins for AUTH, like RPX, Goolge+, etc.
You can enable, disable and modify the behabvior of every plugin thru PAS.
Does it make sense, to NOT use Plone users?
Of course, if you want to share user credentials (Example LDAP), or if you need the user informations in other Apps, etc.
Migration
Should be very simple if the PAS plugins you are using supports "Properties" and "User enumeration".
Get the data from one plugin and put the data into another one with a simple python script. Both supports the same API.
the tool you're looking for is https://pypi.python.org/pypi/pas.plugins.sqlalchemy/0.3
I've used this in a webportal where users are "shared" with a newsletter system.
I've 200 users and any problem.
I think the only "good reason" to store users in an external DB rather in zodb/plone is in a use-case like mine.
Have you ever think about "extend" plone users (ex. https://plone.org/products/collective.examples.userdata)? With plone.api you can easly manipulate users' properties in your code.

Assigning a specific (group of) reviewers in Plone (by 'hand' or automatically)

Is it possible to assign a person or a group of people as reviewers in a certain state of a workflow in Plone?
I have been looking at AutoRole en the IRolesplugin, but do not seem to find what I need?
In our case, users need a multiple review step workflow, yet the first reviewer should have control over which reviewers come afterwards...
Workflows can trigger scripts. Scripts can do things like grant roles to users. You'd have to come up with an approach to letting your first specify additional users. There are probably multiple ways to do it, but I could imagine using archetypes.schemextender or a custom content type to provide a field for choosing additional reviewers, only visible to initial reviewers. Then use those values in the workflow script. http://plone.org/documentation/kb/creating-workflows-in-plone/tutorial-all-pages provides a good overview of how DCWorkflow works.

Resources