Package org.jayasoft.woj.common.model

Examples of org.jayasoft.woj.common.model.PrincipalRight


        sqlRequest = MessageFormat.format(sqlRequest, new Object[]{getParamFromGroupList(principalId, allGroups)});
        List rights =  getObjectsFromQuery(sqlRequest, null, getPrincipalRightRowMapper());
        if (rights == null) {
            return null;
        }
        PrincipalRight r = new PrincipalRight();
        r.setPrincipalId(principalId.longValue());
        r.setPublishVisibility(Visibility.DEFAULT_VISIBILITY);
        for (Iterator iter = rights.iterator(); iter.hasNext();) {
            PrincipalRight pr = (PrincipalRight)iter.next();
            if (pr.getPublishVisibility() != null) {
                if (r.getPublishVisibility().getId()<pr.getPublishVisibility().getId()) {
                    r.setPublishVisibility(pr.getPublishVisibility());
                }
            }               
        }
        return r;
    }
View Full Code Here


        return DSManager.getInstance().getUserDS();
    }
   
   
    protected Object[] getInsertParameters(Object o) {
        PrincipalRight r = (PrincipalRight) o;
        List parameters = new ArrayList();
        parameters.add(new Long(r.getPrincipalId()));
        parameters.add(new Integer(r.getPublishVisibility().getId()));
        return parameters.toArray();
    }
View Full Code Here

        parameters.add(new Integer(r.getPublishVisibility().getId()));
        return parameters.toArray();
    }
   
    protected Object[] getUpdateParameters(Object o) {
        PrincipalRight r = (PrincipalRight) o;
        List parameters = new ArrayList();
        parameters.add(new Integer(r.getPublishVisibility().getId()));
        parameters.add(new Long(r.getPrincipalId()));
        return parameters.toArray();
    }
View Full Code Here

        parameters.add(new Long(r.getPrincipalId()));
        return parameters.toArray();
    }

    protected Object[] getDeleteParameters(Object o) {
        PrincipalRight r = (PrincipalRight) o;
        List parameters = new ArrayList();
        parameters.add(new Long(r.getPrincipalId()));
        return parameters.toArray();
    }
View Full Code Here

    public Object securedInvoke(UAK uak, Map m) {
        String list = (String) m.get(ServerCommands.UPDATE_RIGHT.P_LIST);
        if(list != null) {
            Object[] prs = (Object[]) ServiceProvider.getDefault().getEncodingService().decode(list);
            RightsDao rightDao = WOJServer.getInstance().getDataService().getRightsDao();
            PrincipalRight prToUpdate;
            for (int i = 0; i < prs.length; i++) {
                Object object = prs[i];
                if (object instanceof PrincipalRight) {
                    PrincipalRight pr = (PrincipalRight)object;
                    prToUpdate = rightDao.getRightById(new Long(pr.getPrincipalId()));
                    if (prToUpdate == null) {
                      rightDao.insert(pr);
                    } else {
                      BeanHelper.copy(pr, prToUpdate, User.class);
                      rightDao.update(prToUpdate);
View Full Code Here

                        List groups = Collections.EMPTY_LIST;
                        if(u.getGroup() != null) {
                            groups = Collections.singletonList(new Long(u.getGroup().getId()));
                        }

                        PrincipalRight pr = WOJServer.getInstance().getDataService().getRightsDao().getConsolidatedPrincipalRight(new Long(u.getId()), groups);
                        Visibility publishVisibility = pr == null ? Visibility.DEFAULT_VISIBILITY : pr.getPublishVisibility();
                       
                        UAK uak = new UAK(userName, userPassword, computerIdent, new Long(u.getId()), groups, publishVisibility, pluginId);
                        if (!uak.isAdmin() && !uak.isServer()) {
                            if (!WOJServer.getInstance().getDataService().getLoginTraceDao().login(u, computerIdent)) {
                                LOGGER.info("User : " + u.getLogin() + " has already used a trial on a different computer, login refused");
View Full Code Here

                    //in enterprise edition we create grp instead of getting them from portal
                    if(grpId == 0 && WOJServer.getInstance().isEnterpriseEdition()) {
                      grpId = JDBCIDGenerator.getNextId(JDBCUserDao.PRINCIPAL, dao.getJdbcTemplate()).longValue();
                      group.setId(grpId);
                    }
          PrincipalRight grpRight = new PrincipalRight(grpId, Visibility.PRIVATE)
                    dao.insert(group);
                    rdao.insert(grpRight);
                }
                LOGGER.info(grps.length + "groups successfully added.");
            }
View Full Code Here

              sentObject = new Group();
              BeanHelper.copy(o, sentObject, Group.class);
              ((Group)sentObject).setParent((Group) getDTO(((Group)o).getParent()));
            }
        if (o instanceof PrincipalRight) {
          sentObject = new PrincipalRight();
          BeanHelper.copy(o, sentObject, PrincipalRight.class);
        }
        return sentObject;
    }
View Full Code Here

        userToSave = (UserImpl)DaoFactory.getUserDao().newHandledObject();
        BeanHelper.copy(user, userToSave, User.class);
      }
      DaoFactory.getUserDao().save(userToSave);
      License license = userToSave.getLicenseUsed();
      PrincipalRight pr = null;
      if (license != null && ServiceFactory.getLicenseService().isProfessional(license)) {
        pr = new PrincipalRight(userToSave.getId(), Visibility.PRIVATE);
      } else {
        pr = new PrincipalRight(userToSave.getId(), Visibility.SANDBOX);       
      }
      if(isNew) {
        NotificationService.addUsers(new User[]{userToSave});
      } else {
        NotificationService.updateUsers(new User[]{userToSave});
View Full Code Here

TOP

Related Classes of org.jayasoft.woj.common.model.PrincipalRight

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.