Skip to content
Brendan Robert edited this page Feb 25, 2016 · 5 revisions

#Examples

Example: Activating trees of content

It is possible to activate a single content tree from the miscadmin tools, but in this case it is necessary to activate a few trees and keep tabs on the progress. Create action

After connecting to the AEM server, add a new action and select "Activate Tree". Press OK.

Change action defaults

Note the default values. In this case both were changed to false because it was desired to re-activate content that was already activated and regardless of modification status.

Batch data

A text file holds the list of all paths being activated. In this example the site, DAM content and any associated projects are added. This can be a much longer list, of course.

Open batch

Click on the Batch tab and select "Open Data Set" from the File menu. Select the text file that holds the desired list of paths. Batch settings

The only column in this case is the desired content path to be activated. Make sure all columns have the corresponding variables selected. If using an excel spreadsheet with multiple sheets, first ensure the correct one has been selected.

If the data has any header rows to be ignored, select the desired number of rows to be ignored during data import. In this case there are no header rows so it is left at the default value, 0.

After confirming everything looks correct, press OK to import the data. Data imported

Once import has completed, the batch tab should be populated with the data. Press GO! at the bottom of the screen to get started. In progress

In the Activity Monitor window, the process starts once the GO button is clicked. It may take some time to update the runtime status because bulk activation is not always very fast, especially if the specified node has a lot of children and grandchildren, etc. Once a few items have been completed, the "Time Remaining" estimate can be properly calculated. Finished

Once the bulk process has finished, you can change the report style to a more detailed view if you need to examine any possible failures.

Example: Modifying Users by Query

In this example, we want to query for a list of recently created users and make a change to the group memberships.

First, navigate to the query builder and determine the appropriate query you want to use. The relative path to it is /libs/cq/search/content/querydebug.html

In this example we are using the following query to find all users created in the last day:

  • path=/home
  • type=rep:User
  • 1_relativedaterange.property=jcr:created
  • 1_relativedaterange.lowerBound=-1d
  • 1_relativedaterange.upperBound=0
  • p.guessTotal=true
  • p.limit=-1
  • p.hits=selective
  • p.properties=jcr:path rep:principalName

The query builder debugger offers a JSON link to this after the search button is clicked. Right-click the JSON link and save the results. Here's an example

In Curly, log in to the AEM server and add the "Remove a user from a group" or "Add a user to a group", whichever the case may be for what you need. In this example we're removing a list of users from the Contributor group to prevent logging in to AEM, so we select the action to remove a user.

Remove User action

The first part of the group is already specified in the action so only the path relative to /home/groups is necessary. We are removing users from Contributor so for group name specify /c/contributor

Filling in group name

Next flip to the batch tab and import the json file that was previously saved. Map the rep:principalName to the User Name variable and leave the jcr:path column unmapped. Note There is a faux row added to the top so you can see what the corresponding JSON property names are. The header skip value is automatically set to 1 for you as well.

Mapping in batch import

Now you're ready to go, just click Go and fire away.

Ready to go

Some notes:

  • If you are managing users in a publish environment then it is a good idea to start by deactivating the user, and use the jcr:path for node path in that action. Likewise after making the group membership changes, add another step to activate the user again. It's important to deactivate and reactivate to publisher for SAML configurations because otherwise you'll get replication errors when trying to update existing user nodes (it doesn't like that the password field is empty and throws errors.)
  • There are other cases when you need jcr:path, like the replication example just given. When in doubt, do a few tests from the action tab with different types of data to see what works and what doesn't. Adjust the Query Builder parameters so that you get the data you need and exclude the stuff you don't if possible. Curly can only deal with one level of data in the JSON results so processing complex data is something you'll have to do before Curly can make any sense of it.
Clone this wiki locally