Package es.ipsa.atril.sec.admin

Examples of es.ipsa.atril.sec.admin.AuthorizationAdminManager


    }
   
  public void grantGuest(AtrilSession oSes, User oUsr)
    throws AuthorizationManagerAdminException, ElementNotFoundException, NotEnoughRightsException {
    Log.out.debug("Begin CustomerAccount.grantUser("+oUsr.getEmail()+")");
    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    AdminGroupRights oRgh = AdminRightsFactory.getGroupRightsAllDeny();
    oRgh.setReadGroup(true);
    oRgh.setReadUsers(true);
    oRgh.setLinkResources(true);
    oRgh.setUnlinkResources(true);
    String sBusinessName = getString("business_name");
    AdministeredUser oAsr = oUsr.getAdministeredUser();
    AdministeredGroup oGts = oAam.getGroup(sBusinessName+" guests");
    if (!oGts.getMembers().contains(oAsr)) {
      oGts.addMember(oAsr);   
      oAam.setRights(oAsr, oGts, oRgh);     
    }
    AdministeredGroup oStd = oAam.getGroup(sBusinessName+" standard users");
    if (oStd.getMembers().contains(oAsr))
      oStd.removeMember(oAsr);
    AdministeredGroup oAdm = oAam.getGroup(sBusinessName+" administrators");
    if (oAdm.getMembers().contains(oAsr))
      oAdm.removeMember(oAsr);
    AdministeredGroup oZus = oAam.getGroup("Zesped Users");
    if (!oZus.getMembers().contains(oUsr.getAdministeredUser())) {
      oZus.addMember(oUsr.getAdministeredUser());
      oAam.setRights(oAsr, oZus, oRgh);
    }
    Log.out.debug("End CustomerAccount.grantGuest("+oUsr.getEmail()+")");
  }
View Full Code Here


  }
   
  public void grantUser(AtrilSession oSes, User oUsr)
    throws AuthorizationManagerAdminException, ElementNotFoundException, NotEnoughRightsException {
    Log.out.debug("Begin CustomerAccount.grantUser("+oUsr.getEmail()+")");
    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    AdminGroupRights oRgh = AdminRightsFactory.getGroupRightsAllDeny();
    oRgh.setReadGroup(true);
    oRgh.setReadUsers(true);
    oRgh.setLinkResources(true);
    oRgh.setUnlinkResources(true);
    String sBusinessName = getString("business_name");
    AdministeredUser oAsr = oUsr.getAdministeredUser();
    AdministeredGroup oStd = oAam.getGroup(sBusinessName+" standard users");
    if (!oStd.getMembers().contains(oAsr)) {
      oStd.addMember(oAsr);
      oAam.setRights(oAsr, oStd, oRgh);     
    }
    AdministeredGroup oGts = oAam.getGroup(sBusinessName+" guests");
    if (oGts.getMembers().contains(oAsr))
      oGts.removeMember(oAsr);
    AdministeredGroup oAdm = oAam.getGroup(sBusinessName+" administrators");
    if (oAdm.getMembers().contains(oAsr))
      oAdm.removeMember(oAsr);
    AdministeredGroup oZus = oAam.getGroup("Zesped Users");
    if (!oZus.getMembers().contains(oUsr.getAdministeredUser())) {
      oZus.addMember(oUsr.getAdministeredUser());
      oAam.setRights(oAsr, oZus, oRgh);   
    }
    Log.out.debug("End CustomerAccount.grantUser("+oUsr.getEmail()+")");
  }
View Full Code Here

  }

  public void grantAdmin(AtrilSession oSes, User oUsr)
    throws AuthorizationManagerAdminException, ElementNotFoundException, NotEnoughRightsException {
    Log.out.debug("Begin CustomerAccount.grantAdmin("+oUsr.getEmail()+")");
    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    AdminGroupRights oAll = AdminRightsFactory.getGroupRightsAllGrant();
    String sBusinessName = getString("business_name");
    AdministeredUser oAsr = oUsr.getAdministeredUser();
    AdministeredGroup oAdm = oAam.getGroup(sBusinessName+" administrators");
    if (!oAdm.getMembers().contains(oAsr)) {
      oAdm.addMember(oAsr);
      oAam.setRights(oAsr, oAdm, oAll);
    }
    AdministeredGroup oStd = oAam.getGroup(sBusinessName+" standard users");
    if (oStd.getMembers().contains(oAsr))
      oStd.removeMember(oAsr);
    oAam.setRights(oAsr, oStd, oAll);
    AdministeredGroup oGts = oAam.getGroup(sBusinessName+" guests");
    if (oGts.getMembers().contains(oAsr))
      oGts.removeMember(oAsr);
    oAam.setRights(oAsr, oGts, oAll);
    AdministeredGroup oZus = oAam.getGroup("Zesped Users");
    if (!oZus.getMembers().contains(oUsr.getAdministeredUser())) {
      oZus.addMember(oUsr.getAdministeredUser());
      oAam.setRights(oAsr, oZus, oAll);     
    }
    Log.out.debug("End CustomerAccount.grantAdmin("+oUsr.getEmail()+")");
  }
View Full Code Here

    Log.out.debug("End CustomerAccount.grantAdmin("+oUsr.getEmail()+")");
  }

  public void denyGuest(AtrilSession oSes, User oUsr)
    throws AuthorizationManagerAdminException, ElementNotFoundException, NotEnoughRightsException {
    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    String sBusinessName = getString("business_name");
    AdministeredUser oAsr = oUsr.getAdministeredUser();
    AdministeredGroup oGts = oAam.getGroup(sBusinessName+" guests");
    if (oGts.getMembers().contains(oAsr))
      oGts.removeMember(oAsr);
  }
View Full Code Here

      oGts.removeMember(oAsr);
  }

  public void denyUser(AtrilSession oSes, User oUsr)
    throws AuthorizationManagerAdminException, ElementNotFoundException, NotEnoughRightsException {
    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    String sBusinessName = getString("business_name");
    AdministeredUser oAsr = oUsr.getAdministeredUser();
    AdministeredGroup oStd = oAam.getGroup(sBusinessName+" users");
    if (oStd.getMembers().contains(oAsr))
      oStd.removeMember(oAsr);
  }
View Full Code Here

      oStd.removeMember(oAsr);
  }

  public void denyAdmin(AtrilSession oSes, User oUsr)
    throws AuthorizationManagerAdminException, ElementNotFoundException, NotEnoughRightsException {
    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    String sBusinessName = getString("business_name");
    AdministeredUser oAsr = oUsr.getAdministeredUser();
    AdministeredGroup oAdm = oAam.getGroup(sBusinessName+" admins");
    if (oAdm.getMembers().contains(oAsr))
      oAdm.removeMember(oAsr);
  }
View Full Code Here

  public void createGroups(AtrilSession oSesthrows NullPointerException, IllegalArgumentException {
    Log.out.debug("Begin CustomerAccount.createGroups()");

    long lStart, lEnd;

    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    AdministeredGroup oGrp = oAam.getGroup("Zesped Users");
   
    AdministeredGroup oCom=null, oStd=null, oAdm=null, oGts=null;
    String sBusinessName = getString("business_name");

    try {

      oCom = oAam.getGroup(sBusinessName);
      oGts = oAam.getGroup(sBusinessName+" guests");
      oStd = oAam.getGroup(sBusinessName+" standard users");
      oAdm = oAam.getGroup(sBusinessName+" administrators");

    } catch (ElementNotFoundException enf) {

      // AdminGroupRights oAll = AdminRightsFactory.getGroupRightsAllGrant();
      // lStart = new Date().getTime();
      // AdministeredUser oAsr = oAam.getUser("admin");
      // Log.out.debug("PROFILING: AuthorizationAdminManager.getUser('admin') "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");

      if (null==oCom) {
        Log.out.debug("AuthorizationAdminManager.createGroup("+sBusinessName+")");
        oCom = oAam.createGroup(sBusinessName, "", false, null, oGrp);
        lStart = new Date().getTime();
        // oCom.addMember(oAsr);
        // Log.out.debug("PROFILING: AdministeredGroup.addMember(AdministeredUser) "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
        // lStart = lEnd;
        // oAam.setRights(oAsr, oCom, oAll);
        // Log.out.debug("PROFILING: AuthorizationAdminManager.setRights(...) "+String.valueOf((lEnd=new Date().getTime())-lStart)+" ms");
      }
      if (null==oGts) {
        Log.out.debug("AuthorizationAdminManager.createGroup("+sBusinessName+" guests)");
        oGts = oAam.createGroup(sBusinessName+" guests", sBusinessName+" guests", false, null, oCom);
        // oGts.addMember(oAsr);
        // oAam.setRights(oAsr, oGts, oAll);
      }
      if (null==oStd) {
        Log.out.debug("AuthorizationAdminManager.createGroup("+sBusinessName+" standard users)");
        oStd = oAam.createGroup(sBusinessName+" standard users", sBusinessName+" standard users", false, null, oCom);
        // oStd.addMember(oAsr);
        // oAam.setRights(oAsr, oStd, oAll);
      }
      if (null==oAdm) {
        Log.out.debug("AuthorizationAdminManager.createGroup("+sBusinessName+" administrators)");
        oAdm = oAam.createGroup(sBusinessName+" administrators", sBusinessName+" administrators", false, null, oCom);     
        // oAdm.addMember(oAsr);
        // oAam.setRights(oAsr, oAdm, oAll);
      }
    } 
    Log.out.debug("End CustomerAccount.createGroups()");
View Full Code Here

  }

  public static void createGroups(AtrilSession oSesthrows NullPointerException, IllegalArgumentException {
    Log.out.debug("Begin Zesped.createGroups()");

    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
   
    AdministeredGroup oBeo=null;
 
      try {
        oAam.getGroup(ZESPED_USERS);
      } catch (ElementNotFoundException enf) {
        oAam.createGroup(ZESPED_USERS, "All Zesped Platform Users", false, null, oAam.getGroup("All"));
      }

    AdministeredGroup oGrp = oAam.getGroup(ZESPED_USERS);
     
    try {
      oBeo = oAam.getGroup(BACKEND_OPERATORS);
    } catch (ElementNotFoundException enf) {
      if (null==oBeo) {
        Log.out.debug("AuthorizationAdminManager.createGroup("+BACKEND_OPERATORS+")");
        oBeo = oAam.createGroup(BACKEND_OPERATORS, "", false, null, oGrp);
      }
    }
    Log.out.debug("End Zesped.createGroups()");
  }
View Full Code Here

    if (null==getPassword()) throw new NullPointerException("User.create() password cannot be null");
    if (null==getEmail()) throw new NullPointerException("User.create() email cannot be null");
    if (getEmail().length()==0) throw new NullPointerException("User.create() email cannot be empty");
   
    AuthorizationManager oAum = oSes.getAuthorizationManager();
    AuthorizationAdminManager oAam = oSes.getAuthorizationAdminManager();
    AdministeredGroup oGrp = oAam.getGroup("Zesped Users");
   
    if (null==sNickName) sNickName = Gadgets.generateUUID();

    Log.out.debug("AuthorizationAdminManager.createUser("+sNickName+","+getPassword()+","+getFirstName()+","+getLastName()+","+oGrp.getName()+")");
   
    setAdministeredUser(oAam.createUser(sNickName, getPassword(), getFirstName(), getLastName(), oGrp));

    String sUsrs = Users.top(oSes).getDocument().id();
   
    DocumentIndexer oIdx = oSes.getDocumentIndexer();
    SortableList<Document> oLst = (SortableList<Document>) oSes.getDms().query("User$email='"+getEmail()+"'");
View Full Code Here

      throw new NullPointerException("User.setRole() customer account cannot be null");

    Log.out.debug("Begin User.setRole("+id()+","+eRole+")");
   
    if (oAcc==null) {
      AuthorizationAdminManager oAum = oSes.getAuthorizationAdminManager();
      AdministeredGroup oGrp = oAum.getGroup("Back-End operators");
      if (!oGrp.getMembers().contains(getAdministeredUser()))
        oGrp.addMember(getAdministeredUser());     
    } else {
      if (!getStringNull("customer_acount","").equals(oAcc.getUuid()) ||
         (eRole.equals(Role.admin) && (!canApproveInvoices() || !canSettleBillNotes() || !canUsePremiumCaptureServiceFlavor()))) {
View Full Code Here

TOP

Related Classes of es.ipsa.atril.sec.admin.AuthorizationAdminManager

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.