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