Search in sources :

Example 11 with ActionType

use of org.olat.core.logging.activity.ActionType in project OpenOLAT by OpenOLAT.

the class RepositoryManager method addInternalTutors.

/**
 * Internal method to add tutors, it makes no check.
 * @param ureqIdentity
 * @param identity
 * @param re
 * @param reallyAddedId
 */
private void addInternalTutors(Identity ureqIdentity, Identity identity, RepositoryEntry re, List<Identity> reallyAddedId) {
    repositoryEntryRelationDao.addRole(identity, re, GroupRoles.coach.name());
    reallyAddedId.add(identity);
    ActionType actionType = ThreadLocalUserActivityLogger.getStickyActionType();
    ThreadLocalUserActivityLogger.setStickyActionType(ActionType.admin);
    try {
        ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_OWNER_ADDED, getClass(), LoggingResourceable.wrap(re, OlatResourceableType.genRepoEntry), LoggingResourceable.wrap(identity));
    } finally {
        ThreadLocalUserActivityLogger.setStickyActionType(actionType);
    }
    log.audit("Identity(.key):" + ureqIdentity.getKey() + " added identity '" + identity.getName() + "' to repositoryentry with key " + re.getKey());
}
Also used : ActionType(org.olat.core.logging.activity.ActionType)

Example 12 with ActionType

use of org.olat.core.logging.activity.ActionType in project OpenOLAT by OpenOLAT.

the class RepositoryManager method removeTutor.

private void removeTutor(Identity ureqIdentity, Identity identity, RepositoryEntry re, MailPackage mailing) {
    repositoryEntryRelationDao.removeRole(identity, re, GroupRoles.coach.name());
    RepositoryMailing.sendEmail(ureqIdentity, identity, re, RepositoryMailing.Type.removeTutor, mailing);
    ActionType actionType = ThreadLocalUserActivityLogger.getStickyActionType();
    ThreadLocalUserActivityLogger.setStickyActionType(ActionType.admin);
    try {
        ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_OWNER_REMOVED, getClass(), LoggingResourceable.wrap(re, OlatResourceableType.genRepoEntry), LoggingResourceable.wrap(identity));
    } finally {
        ThreadLocalUserActivityLogger.setStickyActionType(actionType);
    }
    log.audit("Identity(.key):" + ureqIdentity.getKey() + " removed identity '" + identity.getName() + "' from repositoryentry with key " + re.getKey());
}
Also used : ActionType(org.olat.core.logging.activity.ActionType)

Example 13 with ActionType

use of org.olat.core.logging.activity.ActionType in project openolat by klemens.

the class RepositoryManager method removeTutor.

private void removeTutor(Identity ureqIdentity, Identity identity, RepositoryEntry re, MailPackage mailing) {
    repositoryEntryRelationDao.removeRole(identity, re, GroupRoles.coach.name());
    RepositoryMailing.sendEmail(ureqIdentity, identity, re, RepositoryMailing.Type.removeTutor, mailing);
    ActionType actionType = ThreadLocalUserActivityLogger.getStickyActionType();
    ThreadLocalUserActivityLogger.setStickyActionType(ActionType.admin);
    try {
        ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_OWNER_REMOVED, getClass(), LoggingResourceable.wrap(re, OlatResourceableType.genRepoEntry), LoggingResourceable.wrap(identity));
    } finally {
        ThreadLocalUserActivityLogger.setStickyActionType(actionType);
    }
    log.audit("Identity(.key):" + ureqIdentity.getKey() + " removed identity '" + identity.getName() + "' from repositoryentry with key " + re.getKey());
}
Also used : ActionType(org.olat.core.logging.activity.ActionType)

Example 14 with ActionType

use of org.olat.core.logging.activity.ActionType in project openolat by klemens.

the class RepositoryManager method removeOwner.

private void removeOwner(Identity ureqIdentity, Identity identity, RepositoryEntry re, MailPackage mailing) {
    repositoryEntryRelationDao.removeRole(identity, re, GroupRoles.owner.name());
    RepositoryMailing.sendEmail(ureqIdentity, identity, re, RepositoryMailing.Type.removeTutor, mailing);
    ActionType actionType = ThreadLocalUserActivityLogger.getStickyActionType();
    ThreadLocalUserActivityLogger.setStickyActionType(ActionType.admin);
    try {
        ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_OWNER_REMOVED, getClass(), LoggingResourceable.wrap(re, OlatResourceableType.genRepoEntry), LoggingResourceable.wrap(identity));
    } finally {
        ThreadLocalUserActivityLogger.setStickyActionType(actionType);
    }
    log.audit("Identity(.key):" + ureqIdentity.getKey() + " removed identity '" + identity.getName() + "' from repositoryentry with key " + re.getKey());
}
Also used : ActionType(org.olat.core.logging.activity.ActionType)

Example 15 with ActionType

use of org.olat.core.logging.activity.ActionType in project openolat by klemens.

the class RepositoryManager method addOwners.

/**
 * add provided list of identities as owners to the repo entry. silently ignore
 * if some identities were already owners before.
 * @param ureqIdentity
 * @param addIdentities
 * @param re
 * @param userActivityLogger
 */
public void addOwners(Identity ureqIdentity, IdentitiesAddEvent iae, RepositoryEntry re, MailPackage mailing) {
    List<Identity> addIdentities = iae.getAddIdentities();
    List<Identity> reallyAddedId = new ArrayList<Identity>();
    for (Identity identity : addIdentities) {
        if (!repositoryEntryRelationDao.hasRole(identity, re, GroupRoles.owner.name())) {
            repositoryEntryRelationDao.addRole(identity, re, GroupRoles.owner.name());
            reallyAddedId.add(identity);
            ActionType actionType = ThreadLocalUserActivityLogger.getStickyActionType();
            ThreadLocalUserActivityLogger.setStickyActionType(ActionType.admin);
            try {
                ThreadLocalUserActivityLogger.log(GroupLoggingAction.GROUP_OWNER_ADDED, getClass(), LoggingResourceable.wrap(re, OlatResourceableType.genRepoEntry), LoggingResourceable.wrap(identity));
            } finally {
                ThreadLocalUserActivityLogger.setStickyActionType(actionType);
            }
            RepositoryMailing.sendEmail(ureqIdentity, identity, re, RepositoryMailing.Type.addOwner, mailing);
            log.audit("Identity(.key):" + ureqIdentity.getKey() + " added identity '" + identity.getName() + "' to repoentry with key " + re.getKey());
        }
    // else silently ignore already owner identities
    }
    iae.setIdentitiesAddedEvent(reallyAddedId);
}
Also used : ActionType(org.olat.core.logging.activity.ActionType) ArrayList(java.util.ArrayList) Identity(org.olat.core.id.Identity)

Aggregations

ActionType (org.olat.core.logging.activity.ActionType)16 Identity (org.olat.core.id.Identity)6 ArrayList (java.util.ArrayList)4 MailPackage (org.olat.core.util.mail.MailPackage)2 RepositoryEntryMembershipModifiedEvent (org.olat.repository.model.RepositoryEntryMembershipModifiedEvent)2 ResourceReservation (org.olat.resource.accesscontrol.ResourceReservation)2