Examples of ResourceType


Examples of com.adito.policyframework.ResourceType

    public ActionForward unspecified(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
                    throws Exception {
      int resourceId = Integer.parseInt(request.getParameter("resourceId"));
      int resourceTypeId = Integer.parseInt(request.getParameter("resourceType"));
      ResourceType resourceType = PolicyDatabaseFactory.getInstance().getResourceType(resourceTypeId);
      request.setAttribute(Constants.REQ_ATTR_INFO_RESOURCE, resourceType.getResourceById(resourceId));
      return information(mapping, form, request, response);
    }
View Full Code Here

Examples of com.adito.policyframework.ResourceType

                    throws Exception {
        String id = ((FavoritesForm) form).getSelectedItem();
        int idx = id.indexOf('_');
        int type = Integer.parseInt(id.substring(0, idx));
        int key = Integer.parseInt(id.substring(idx + 1));
        ResourceType ty = PolicyDatabaseFactory.getInstance().getResourceType(type);
        if(ty != null && ty instanceof FavoriteResourceType) {
            FavoriteResourceType frt = (FavoriteResourceType)ty;
            Resource r = frt.getResourceById(key);           
            if(ResourceUtil.isResourceGlobalFavorite(r)) {
                throw new Exception("Cannot remove policy favorites here.");
View Full Code Here

Examples of com.adito.policyframework.ResourceType

                    throws Exception {
        String id = ((FavoritesForm) form).getSelectedItem();
        int idx = id.indexOf('_');
        int type = Integer.parseInt(id.substring(0, idx));
        int key = Integer.parseInt(id.substring(idx + 1));
        ResourceType ty = PolicyDatabaseFactory.getInstance().getResourceType(type);
        if(ty != null && ty instanceof FavoriteResourceType) {
            FavoriteResourceType frt = (FavoriteResourceType)ty;
            Resource r = frt.getResourceById(key);
            request.setAttribute(Constants.REQ_ATTR_INFO_RESOURCE, r);
        }
View Full Code Here

Examples of com.adito.policyframework.ResourceType

        getRepository().getSession());
     
      if (resource == null) {
        throw new Exception("No network place resource named " + mountName);
      }
      ResourceType resourceType = resource.getResourceType();
      boolean readOnly = false;
     
      if (!getProvider().willHandle(resource.getScheme())) {
        throw new Exception("Network place has scheme " + resource.getScheme() + ", this store doesn't support it.");
      }
View Full Code Here

Examples of com.adito.policyframework.ResourceType

                || resourceTypesToExclude.size() == 0) {
              val = Boolean.TRUE;
              break;
            }
            int rtn = rs.getInt("resource_type");
            ResourceType rt = getResourceType(rtn);
            if (rt == null) {
              log
                  .warn("Failed to locate resource type with ID of "
                      + rtn
                      + ". Its possible this was created by a plugin which is no longer available.");
            } else {
              if (!resourceTypesToExclude.contains(rt)) {
                val = Boolean.TRUE;
                break;
              }
            }
          } else {
            break;
          }
        }

        // If the principal is a user, the get their roles and check
        // those as well
        if (val == null && principal instanceof User) {
          // Now try roles
          Role[] r = ((User) principal).getRoles();
          if (r != null) {
            for (int i = 0; val == null && i < r.length; i++) {

              if (r[i] == null) {
                log.warn("NULL role in principal "
                    + principal.getPrincipalName());
                continue;
              }

              ps.reset();
              if (resourceRequired == null) {
                ps = db
                    .getStatement("isPrincipalGranted.selectAny");
                ps.setString(1, r[i].getPrincipalName());
                ps.setInt(2, Policy.PRINCIPAL_GROUP);
                                ps.setInt(3, principal.getRealm().getResourceId());
              } else {
                ps = db
                    .getStatement("isPrincipalGranted.selectType");
                ps.setInt(1, resourceRequired
                    .getResourceTypeId());
                ps.setString(2, r[i].getPrincipalName());
                ps.setInt(3, Policy.PRINCIPAL_GROUP);
                ps.setInt(4, resourceRequired
                    .getResourceTypeId());
                                ps.setInt(5, principal.getRealm().getResourceId());
              }

              try {
                rs = ps.executeQuery();
                while (true) {
                  if (rs.next()) {
                    if (resourceTypesToExclude == null
                        || resourceTypesToExclude
                            .size() == 0) {
                      val = Boolean.TRUE;
                      break;
                    }
                    int rtn = rs.getInt("resource_type");
                    ResourceType rt = getResourceType(rtn);
                    if (rt == null) {
                      log
                          .warn("Failed to locate resource type with ID of "
                              + rtn
                              + ". Its possible this was created by a plugin which is no longer available.");
View Full Code Here

Examples of com.adito.policyframework.ResourceType

                lastId = resourceId;
            }
            // check to see if the access right has any permissions
            if (!JDBCUtil.isNull(resultSet, "resource_type_id")) {
                int resourceTypeId = resultSet.getInt("resource_type_id");
                ResourceType resourceType = getResourceType(resourceTypeId);
                if (resourceType == null) {
                    log.warn("No resource type with Id of " + resourceTypeId + " for resource permission " + resourceId
                                    + ", ignoring");
                } else {
                    int permissionId = resultSet.getInt("permission_id");
                    Permission permission = resourceType.getPermission(permissionId);
                    if (permission == null) {
                        log.warn("No permission with Id of " + permissionId + " for resource type " + resourceTypeId
                                        + " and resource permission " + resourceId + ", ignoring");
                    } else {
                        AccessRight accessRight = new AccessRight(resourceType, permission);
View Full Code Here

Examples of com.adito.policyframework.ResourceType

            return false;
        }
    }
   
    private boolean isPermitted(User user) throws Exception {
        ResourceType resourceType = PolicyDatabaseFactory.getInstance().getResourceType(PolicyConstants.ACCOUNTS_AND_GROUPS_RESOURCE_TYPE_ID);
        Permission[] permissions = getPermissions(resourceType);
        boolean isPermitted = permissions.length == 0 ? true : PolicyDatabaseFactory.getInstance().isPermitted(resourceType, permissions, user, true);
       
        UserDatabase userDatabase = UserDatabaseManager.getInstance().getUserDatabase(user.getRealm().getResourceId());
        if(requiresPasswordSupport) {
View Full Code Here

Examples of com.adito.policyframework.ResourceType

            user = LogonControllerFactory.getInstance().getUser(pageContext.getSession(), null);
            if (user == null) {
                return required ? SKIP_BODY : EVAL_BODY_INCLUDE;
            } else {
               
                ResourceType resourceType = null;
                if (resourceTypeId != -1) {
                    if (permissionList.equals("")) {
                        throw new Error("No permissionMask attribute supplied.");
                    }
                    resourceType = PolicyDatabaseFactory.getInstance().getResourceType(resourceTypeId);
                }               
                if (resourceType != null) {                       
                    StringTokenizer t = new StringTokenizer(permissionList, ",");
                    List allowed = new ArrayList();
                    List denied = new ArrayList();
                    while(t.hasMoreTokens()) {
                        String perm = t.nextToken();
                        if(perm.startsWith("!")) {
                            int id = Integer.parseInt(perm.substring(1));
                            Permission permInfo = resourceType.getPermission(id);
                            if(permInfo == null) {
                                throw new Error("No permission with ID of " + id + " in resource type " + resourceType.getResourceTypeId());
                            }
                            denied.add(permInfo);
                        }
                        else {
                            int id = Integer.parseInt(perm);
                            Permission permInfo = resourceType.getPermission(id);
                            if(permInfo == null) {
                                throw new Error("No permission with ID of " + id + " in resource type " + resourceType.getResourceTypeId());
                            }
                            allowed.add(permInfo);
                        }
                    }                   
                    Permission[] allowedPerms = (Permission[])
View Full Code Here

Examples of com.adito.policyframework.ResourceType

     * @param pageContext page context from which to get the message resources
     * @return resource type string
     * @throws JspException on error retrieving message resources
     */
    public String getResourceTypeName(PageContext pageContext) throws JspException {
        ResourceType rt = getFavoriteItem().getResource() == null ? null : getFavoriteItem().getResource().getResourceType();
        if (rt == null) {
            return "?";
        } else {
            MessageResources mr = TagUtils.getInstance().retrieveMessageResources(pageContext, rt.getBundle(), false);
            rt.getBundle();
            if (mr == null) {
                return "!Invalid bundle!";
            } else {
                String msg = mr.getMessage("resourceType." + rt.getResourceTypeId() + ".title");
                return msg == null || msg.equals("") ? "!No message!" : msg;
            }
        }

    }
View Full Code Here

Examples of com.adito.policyframework.ResourceType

        SessionInfo info = LogonControllerFactory.getInstance().getSessionInfo(request);
        getModel().clear();
        try {
            User user = LogonControllerFactory.getInstance().getUser(request);
            for (Iterator i = PolicyDatabaseFactory.getInstance().getResourceTypes(null).iterator(); i.hasNext();) {
                ResourceType rt = (ResourceType) i.next();
                if (rt instanceof FavoriteResourceType) {
                    FavoriteResourceType frt = (FavoriteResourceType) rt;
                    try {
                        List fl = SystemDatabaseFactory.getInstance().getFavorites(frt.getResourceTypeId(), user);
                        for (Iterator j = fl.iterator(); j.hasNext();) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.