Esempio n. 1
0
    PrincipalsDAO.getPrincipal(resource.resourceId, function(err, group) {
        if (err) {
            return callback(err);
        }

        return callback(null, PrincipalsUtil.createPersistentGroupActivityEntity(group.id, group));
    });
Esempio n. 2
0
ActivityAPI.registerActivityEntityProducer('group', function(activityType, entityType, resource, callback) {
    var group = (resource.resourceData) ? resource.resourceData.group : null;

    // If the group was delivered with the resource, use it instead of fetching
    if (group) {
        return callback(null, PrincipalsUtil.createPersistentGroupActivityEntity(group.id, group));
    }

    // Only the group id was added to the resource, query the group
    PrincipalsDAO.getPrincipal(resource.resourceId, function(err, group) {
        if (err) {
            return callback(err);
        }

        return callback(null, PrincipalsUtil.createPersistentGroupActivityEntity(group.id, group));
    });
});