Package org.apache.clerezza.rdf.core.access.security

Examples of org.apache.clerezza.rdf.core.access.security.TcPermission


  @Override
  public Set<GlobalMenuItem> getMenuItems() {
    Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
    try {
      AccessController.checkPermission(new TcPermission(
          SystemConfig.SYSTEM_GRAPH_URI.getUnicodeString(), "readwrite"));
      AccessController.checkPermission(new UserManagerAccessPermission());
    } catch (AccessControlException e) {
      return items;
    }


  @Override
  public Set<GlobalMenuItem> getMenuItems() {
    Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
    try {
      AccessController.checkPermission(
          new TcPermission("urn:x-localinstance:/content.graph",
          TcPermission.READWRITE));
      AccessController.checkPermission(new ScriptManagerAppPermission());
    } catch (AccessControlException e) {
      return items;
    }

  @Override
  public Set<GlobalMenuItem> getMenuItems() {
    Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
    try {
      AccessController.checkPermission(
          new TcPermission("urn:x-localinstance:/content.graph",
          TcPermission.READWRITE));
    } catch (AccessControlException e) {
      return items;
    }
    try {

    Policy.setPolicy(new Policy() {

      @Override
      public PermissionCollection getPermissions(CodeSource codeSource) {
        PermissionCollection result = new Permissions();
        result.add(new TcPermission("http://example.org/permitted", "read"));
        result.add(new TcPermission("http://example.org/graph/alreadyexists", "readwrite"));
        result.add(new TcPermission("http://example.org/read/graph", "read"));
        result.add(new TcPermission("http://example.org/area/allowed/*", "readwrite"));
        result.add(new TcPermission("urn:x-localinstance:/graph-access.graph", "readwrite"));
        //result.add(new AllPermission());
        result.add(new RuntimePermission("*"));
        result.add(new ReflectPermission("suppressAccessChecks"));
        result.add(new PropertyPermission("*", "read"));
        //(java.util.PropertyPermission line.separator read)

  public Set<GlobalMenuItem> getMenuItems() {
    Set<GlobalMenuItem> items = new HashSet<GlobalMenuItem>();
    try {
      AccessController.checkPermission(new ConfigGuiAccessPermission());
      AccessController.checkPermission(
          new TcPermission(SystemConfig.SYSTEM_GRAPH_URI.toString(),
          TcPermission.READWRITE));
    } catch (AccessControlException e) {
      return items;
    }
    items.add(new GlobalMenuItem("/admin/configuration", "Configuration", "Configuration", 2,

    Collection<Permission> requiredReadPermissions =
        tcManager.getTcAccessController().getRequiredReadPermissions(Constants.CONTENT_GRAPH_URI);
    if (requiredReadPermissions.isEmpty()) {
      tcManager.getTcAccessController().setRequiredReadPermissionStrings(
          ENRICHMENT_GRAPH_URI, Collections.singleton(
            new TcPermission(Constants.CONTENT_GRAPH_URI_STRING, TcPermission.READ).toString()
          ));
    } else {
      tcManager.getTcAccessController().setRequiredReadPermissions(
          ENRICHMENT_GRAPH_URI, requiredReadPermissions);
    }

            tcManager.createMGraph(REQUEST_LOG_GRAPH_NAME);
            //now make sure everybody can read from the graph
            //or more precisly, anybody who can read the content-graph
            TcAccessController tca = new TcAccessController(tcManager);
            tca.setRequiredReadPermissions(REQUEST_LOG_GRAPH_NAME,
                    Collections.singleton((Permission)new TcPermission(
                    "urn:x-localinstance:/content.graph", "read")));
        } catch (EntityAlreadyExistsException ex) {
            log.debug("The graph for the request log already exists");
        }
       

        Policy.setPolicy(new Policy() {

            @Override
            public PermissionCollection getPermissions(CodeSource codeSource) {
                PermissionCollection result = new Permissions();
                result.add(new TcPermission("http://example.org/permitted", "read"));
                result.add(new TcPermission("http://example.org/graph/alreadyexists", "readwrite"));
                result.add(new TcPermission("http://example.org/read/graph", "read"));
                result.add(new TcPermission("http://example.org/area/allowed/*", "readwrite"));
                result.add(new TcPermission("urn:x-localinstance:/graph-access.graph", "readwrite"));
                //result.add(new AllPermission());
                result.add(new RuntimePermission("*"));
                result.add(new ReflectPermission("suppressAccessChecks"));
                result.add(new PropertyPermission("*", "read"));
                //(java.util.PropertyPermission line.separator read)

TOP

Related Classes of org.apache.clerezza.rdf.core.access.security.TcPermission

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.