Search in sources :

Example 6 with PoolImpl

use of org.olat.modules.qpool.model.PoolImpl in project OpenOLAT by OpenOLAT.

the class PoolsAdminController method doManageOwners.

private void doManageOwners(UserRequest ureq, Pool pool) {
    if (pool instanceof PoolImpl) {
        PoolImpl poolImpl = (PoolImpl) pool;
        groupCtrl = new GroupController(ureq, getWindowControl(), true, true, false, true, false, false, poolImpl.getOwnerGroup());
        groupCtrl.setUserObject(pool);
        listenTo(groupCtrl);
        cmc = new CloseableModalController(getWindowControl(), translate("close"), groupCtrl.getInitialComponent(), true, translate("pool.owners"));
        cmc.activate();
        listenTo(cmc);
    }
}
Also used : GroupController(org.olat.admin.securitygroup.gui.GroupController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) PoolImpl(org.olat.modules.qpool.model.PoolImpl)

Example 7 with PoolImpl

use of org.olat.modules.qpool.model.PoolImpl in project openolat by klemens.

the class QuestionPoolServiceImpl method removeOwners.

@Override
public void removeOwners(List<Identity> owners, List<Pool> pools) {
    if (owners == null || owners.isEmpty() || pools == null || pools.isEmpty()) {
        // nothing to do
        return;
    }
    List<SecurityGroup> secGroups = new ArrayList<SecurityGroup>(pools.size());
    for (Pool pool : pools) {
        SecurityGroup secGroup = ((PoolImpl) pool).getOwnerGroup();
        secGroups.add(secGroup);
    }
    securityManager.removeIdentityFromSecurityGroups(owners, secGroups);
}
Also used : ArrayList(java.util.ArrayList) QuestionItem2Pool(org.olat.modules.qpool.QuestionItem2Pool) Pool(org.olat.modules.qpool.Pool) SecurityGroup(org.olat.basesecurity.SecurityGroup) PoolImpl(org.olat.modules.qpool.model.PoolImpl)

Example 8 with PoolImpl

use of org.olat.modules.qpool.model.PoolImpl in project openolat by klemens.

the class PoolDAO method createPool.

public PoolImpl createPool(Identity owner, String name, boolean publicPool) {
    PoolImpl pool = new PoolImpl();
    pool.setCreationDate(new Date());
    pool.setLastModified(new Date());
    pool.setName(name);
    pool.setPublicPool(publicPool);
    SecurityGroup ownerGroup = securityManager.createAndPersistSecurityGroup();
    pool.setOwnerGroup(ownerGroup);
    dbInstance.getCurrentEntityManager().persist(pool);
    if (owner != null) {
        securityManager.addIdentityToSecurityGroup(owner, ownerGroup);
    }
    return pool;
}
Also used : PoolImpl(org.olat.modules.qpool.model.PoolImpl) SecurityGroup(org.olat.basesecurity.SecurityGroup) Date(java.util.Date)

Aggregations

PoolImpl (org.olat.modules.qpool.model.PoolImpl)8 SecurityGroup (org.olat.basesecurity.SecurityGroup)4 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 GroupController (org.olat.admin.securitygroup.gui.GroupController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 Pool (org.olat.modules.qpool.Pool)2 QuestionItem2Pool (org.olat.modules.qpool.QuestionItem2Pool)2