Package org.olat.basesecurity

Examples of org.olat.basesecurity.SecurityGroup


    }

    // Create Identity
    Identity identity = securityManager.createAndPersistIdentityAndUser(uid, user, LDAPAuthenticationController.PROVIDER_LDAP, uid, null);
    // Add to SecurityGroup LDAP
    SecurityGroup secGroup = securityManager.findSecurityGroupByName(LDAPConstants.SECURITY_GROUP_LDAP);
    securityManager.addIdentityToSecurityGroup(identity, secGroup);
    // Add to SecurityGroup OLATUSERS
    secGroup = securityManager.findSecurityGroupByName(Constants.GROUP_OLATUSERS);
    securityManager.addIdentityToSecurityGroup(identity, secGroup);
    log.info("Created LDAP user username::" + uid);
View Full Code Here


    Manager securityManager = ManagerFactory.getManager();
    Identity identity = securityManager.findIdentityByName(uid);
    if (identity == null) {
      return null;
    } else {
      SecurityGroup ldapGroup = securityManager.findSecurityGroupByName(LDAPConstants.SECURITY_GROUP_LDAP);
      if (ldapGroup == null) {
        log.error("Error getting user from OLAT security group '" + LDAPConstants.SECURITY_GROUP_LDAP + "' : group does not exist");
        return null;
      }
      if (securityManager.isIdentityInSecurityGroup(identity, ldapGroup)) {
View Full Code Here

      return null;
    }

    // Find all User in OLAT, members of LDAPSecurityGroup
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup ldapGroup = securityManager.findSecurityGroupByName(LDAPConstants.SECURITY_GROUP_LDAP);
    if (ldapGroup == null) {
      log.error("Error getting users from OLAT security group '" + LDAPConstants.SECURITY_GROUP_LDAP + "' : group does not exist");
      return null;
    }
    List<Identity> olatListIdentity = securityManager.getIdentitiesOfSecurityGroup(ldapGroup);
View Full Code Here

          // check if more not more than the defined percentages of
          // users managed in LDAP should be deleted
          // if they are over the percentage, they will not be deleted
          // by the sync job
          Manager securityManager = ManagerFactory.getManager();
          SecurityGroup ldapGroup = securityManager
              .findSecurityGroupByName(LDAPConstants.SECURITY_GROUP_LDAP);
          List<Identity> olatListIdentity = securityManager
              .getIdentitiesOfSecurityGroup(ldapGroup);
          if (olatListIdentity.size() == 0)
            log
View Full Code Here

          leaf.setAttribute(XML_ACC, tmp);                                      // access rights as attribute
          leaf.appendChild(links);                                              // append links container
         
          Element owners = doc.createElement(XML_OWN);                          // owners node
          leaf.appendChild(owners);
          SecurityGroup sg = re.getOwnerGroup();
          List m = securityManager.getIdentitiesOfSecurityGroup(sg);
          for (Iterator iter = m.iterator(); iter.hasNext();) {
            Identity i = (Identity) iter.next();
            cur = doc.createElement(XML_USR);                                    // get all users
            cur.appendChild(doc.createTextNode(i.getName()));
View Full Code Here

      /*
       * edit current category's ownergroup
       */
      else if (event.getCommand().equals(ACTION_EDIT_CTLGCATOWNER)) {
        // add ownership management
        SecurityGroup secGroup = currentCatalogEntry.getOwnerGroup();
        if (secGroup == null) {
          CatalogEntry reloaded = cm.loadCatalogEntry(currentCatalogEntry);
          currentCatalogEntry = reloaded;// FIXME:pb:?
          secGroup = ManagerFactory.getManager().createAndPersistSecurityGroup();
          currentCatalogEntry.setOwnerGroup(secGroup);
          cm.saveCatalogEntry(currentCatalogEntry);
        }
        boolean keepAtLeastOne = currentCatalogEntryLevel == 0;
        removeAsListenerAndDispose(groupController);
        groupController = new GroupController(ureq, getWindowControl(), true, keepAtLeastOne, false, secGroup);
        listenTo(groupController);
        // open form in dialog
        removeAsListenerAndDispose(cmc);
        cmc = new CloseableModalController(getWindowControl(), "close", groupController.getInitialComponent(), true, translate("tools.edit.catalog.category.ownergroup"));
        listenTo(cmc);
        cmc.activate();         
      }
      /*
       * delete category (subtree)
       */
      else if (event.getCommand().equals(ACTION_DELETE_CTLGCATEGORY)) {
        catModificationLock = CoordinatorManager.getCoordinator().getLocker().acquireLock(OresHelper.createOLATResourceableType(CatalogController.class), ureq.getIdentity(), LOCK_TOKEN);
        if ( ! catModificationLock.isSuccess()) {
          showError("catalog.locked.by", catModificationLock.getOwner().getName());
          return;
        }
        String[] trnslP = { currentCatalogEntry.getName() };
        dialogDeleteSubtree = activateYesNoDialog(ureq, null, getTranslator().translate(NLS_DIALOG_MODAL_SUBTREE_DELETE_TEXT, trnslP), dialogDeleteSubtree);
        return;
      }
      /*
       * contact caretaker, request subcategory, request deletion of an entry,
       * etc.
       */
      else if (event.getCommand().equals(ACTION_NEW_CTGREQUEST)) {
        /*
         * find the first caretaker, looking from the leaf towards the root,
         * following the selected branch.
         */
        Manager mngr = ManagerFactory.getManager();
        ContactList caretaker = new ContactList(translate(NLS_CONTACT_TO_GROUPNAME_CARETAKER));
        final List emptyList = new ArrayList();
        List tmpIdent = new ArrayList();
        for (int i = historyStack.size() - 1; i >= 0 && tmpIdent.isEmpty(); i--) {
          // start at the selected category, the root category is asserted to
          // have the OLATAdministrator
          // so we end up having always at least one identity as receiver for a
          // request ;-)
          CatalogEntry tmp = historyStack.get(i);
          SecurityGroup tmpOwn = tmp.getOwnerGroup();
          if (tmpOwn != null) tmpIdent = mngr.getIdentitiesOfSecurityGroup(tmpOwn);
          else tmpIdent = emptyList;
        }
        for (int i = tmpIdent.size() - 1; i >= 0; i--) {
          caretaker.add((Identity) tmpIdent.get(i));
View Full Code Here

  /**
   * Helper to imports simple tree structure, for simplicity
   */
  private void importStructure() {
    CatalogEntry oldRoot = (CatalogEntry) cm.getRootCatalogEntries().get(0);
    SecurityGroup rootOwners = oldRoot.getOwnerGroup();
    Manager secMgr = ManagerFactory.getManager();
    List olatAdminIdents = secMgr.getIdentitiesOfSecurityGroup(rootOwners);
    SecurityGroup catalogAdmins = secMgr.createAndPersistSecurityGroup();
    for (int i = 0; i < olatAdminIdents.size(); i++) {
      secMgr.addIdentityToSecurityGroup((Identity) olatAdminIdents.get(i), catalogAdmins);
    }
    cm.deleteCatalogEntry(oldRoot);

View Full Code Here

      canRemoveAllLinks = isOLATAdmin;
      fireEvent(ureq, Event.CHANGED_EVENT);
     
    } else if (isLocalTreeAdminLevel == -1) {
      // 3b) check if user is admin for this level
      SecurityGroup owners = ce.getOwnerGroup();
      boolean isInGroup = false;
      if (owners != null) {
        isInGroup = ManagerFactory.getManager().isIdentityInSecurityGroup(ureq.getIdentity(), owners);
      }
      if (isInGroup) {
View Full Code Here

    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(importedRepositoryEntry);
    importedRepositoryEntry.setCanLaunch(rh.supportsLaunch());
   
    // create security group
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup newGroup = securityManager.createAndPersistSecurityGroup();
    // member of this group may modify member's membership
    securityManager.createAndPersistPolicy(newGroup, Constants.PERMISSION_ACCESS, newGroup);
    // members of this group are always authors also
    securityManager.createAndPersistPolicy(newGroup, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR);
    securityManager.addIdentityToSecurityGroup(owner, newGroup);
View Full Code Here

    RepositoryHandler rh = RepositoryHandlerFactory.getInstance().getRepositoryHandler(importedRepositoryEntry);
    importedRepositoryEntry.setCanLaunch(rh.supportsLaunch());

    // create security group
    Manager securityManager = ManagerFactory.getManager();
    SecurityGroup newGroup = securityManager.createAndPersistSecurityGroup();
    // member of this group may modify member's membership
    securityManager.createAndPersistPolicy(newGroup, Constants.PERMISSION_ACCESS, newGroup);
    // members of this group are always authors also
    securityManager.createAndPersistPolicy(newGroup, Constants.PERMISSION_HASROLE, Constants.ORESOURCE_AUTHOR);
    securityManager.addIdentityToSecurityGroup(owner, newGroup);
View Full Code Here

TOP

Related Classes of org.olat.basesecurity.SecurityGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.