onDelete-user-cleanup.js revision 44966df35694eb9aebef0cd3fc2b22bfde5f8f61
0N/A/**
3261N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0N/A *
0N/A * Copyright (c) 2012 ForgeRock AS. All Rights Reserved
0N/A *
0N/A * The contents of this file are subject to the terms
2362N/A * of the Common Development and Distribution License
0N/A * (the License). You may not use this file except in
2362N/A * compliance with the License.
0N/A *
0N/A * You can obtain a copy of the License at
0N/A * http://forgerock.org/license/CDDLv1.0.html
0N/A * See the License for the specific language governing
0N/A * permission and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL
0N/A * Header Notice in each file and include the License file
0N/A * at http://forgerock.org/license/CDDLv1.0.html
0N/A * If applicable, add the following below the CDDL Header,
0N/A * with the fields enclosed by brackets [] replaced by
2362N/A * your own identifying information:
2362N/A * "Portions Copyrighted [year] [name of copyright owner]"
2362N/A */
0N/A
0N/A/*global object */
0N/A
0N/Avar userId = object._id,
0N/A notificationPointer,
0N/A findUserNotificationsParams = {
0N/A "_queryId": "get-notifications-for-user",
0N/A "userId": userId
0N/A },
0N/A notificationQueryResult;
0N/A
0N/AnotificationQueryResult = openidm.query("repo/ui/notification", findUserNotificationsParams);
0N/Aif (notificationQueryResult.result && notificationQueryResult.result.length!==0) {
0N/A
0N/A for (notificationPointer=0;notificationPointer<notificationQueryResult.result.length;notificationPointer++) {
0N/A var notification = notificationQueryResult.result[notificationPointer];
0N/A openidm['delete']('repo/ui/notification/' + notification._id, notification._rev);
0N/A }
0N/A
0N/A}