Saiku3.15去除License与主界面

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/yvigmmwfn/article/details/78914866
  1. 资源下载

  2. 修改org.saiku.web.service.SessionService.java

public Map<String, Object> login(HttpServletRequest req, String username, String password ) throws LicenseException {
//      Object sl = null;
//      String notice = null;
        HttpSession session = ((HttpServletRequest)req).getSession(true);
        session.getId();
        sessionRepo.setSession(session);

//      try {
//          sl = l.getLicense();
//      } catch (Exception e) {
//          log.debug("Could not process license", e);
//          throw new LicenseException("Error fetching license. Get a free license from http://licensing.meteorite.bi. You can upload it at /upload.html");
//      }

//      if (sl != null) {
        if (true) {

//          try {
//              l.validateLicense();
//          } catch (RepositoryException | IOException | ClassNotFoundException e) {
//              log.debug("Repository Exception, couldn't get license", e);
//              throw new LicenseException("Error fetching license. Please check your logs.");
//          }

            //              if (l.getLicense() instanceof SaikuLicense2) {
            if (true) {
                if (authenticationManager != null) {
                    authenticate(req, username, password);
                }
                if (SecurityContextHolder.getContext() != null
                    && SecurityContextHolder.getContext().getAuthentication() != null) {
                    Authentication auth = SecurityContextHolder.getContext().getAuthentication();

                    if (authorisationPredicate.isAuthorised(auth)) {
                        Object p = auth.getPrincipal();
                        createSession(auth, username, password);
                        return sessionHolder.get(p);
                    } else {
                        log.info(username + " failed authorisation. Rejecting login");
                        throw new RuntimeException("Authorisation failed for: " + username);
                    }
                }
                return new HashMap<>();
            }
        }
        return null;
    }
  1. 修改org.saiku.web.rest.resources.License.java
public Response getLicense() {
//    try {
//      return Response.ok().entity(licenseUtils.getLicense()).build();
//    } catch (IOException | RepositoryException | ClassNotFoundException e) {
//      e.printStackTrace();
//    }
//    return Response.serverError().build();

      return Response.ok().build();
    }

public Response validateLicense() {
//    if(!userService.isAdmin()){
//      return Response.status(Response.Status.FORBIDDEN).build();
//    }
//    try {
//      licenseUtils.validateLicense();
//    } catch (IOException e) {
//      e.printStackTrace();
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity(e.getLocalizedMessage()).build();
//    } catch (ClassNotFoundException e) {
//      e.printStackTrace();
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity(e.getLocalizedMessage()).build();
//    } catch (LicenseException e) {
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity(e.getLocalizedMessage()).build();
//    } catch (RepositoryException e) {
//      return Response.status(Response.Status.INTERNAL_SERVER_ERROR)
//                     .entity("Could not find license file").build();
//    } catch (Exception e) {
//      e.printStackTrace();
//    }
    return Response.ok().entity("Valid License").build();


  }  
  1. 去除商业提示信息

a) saiku-server\tomcat\webapps\ROOT\index.html

<!-- 
<script type="text/x-jquery-tmpl" id="template-upgrade">
            <div class="upgradeheader">
                You are using Saiku Community Edition, please consider <a target="_blank" href="http://saiku.meteorite.bi/support">purchasing support, or entering a sponsorship agreement with us</a> to support development. <a href="mailto:[email protected]?subject=Supporting Saiku">[email protected]</a><span class="close_tab sprite"></span>
            </div>
        </script>
-->

b) saiku-server\tomcat\webapps\ROOT\js\saiku\views\Upgrade.js

render: function() {
        return this;

/*
        var self = this;
        var license = new License();

        if(Settings.BIPLUGIN5){
                if(Saiku.session.get("notice") != undefined && Saiku.session.get("notice")!=null && Saiku.session.get("notice")!=""){
                    $(this.el).append("<div><div id='uphead' class='upgradeheader'>Notice:"+Saiku.session.get("notice")+"</div>");

                }
                if (Settings.LICENSE.licenseType != undefined && (Settings.LICENSE.licenseType != "trial" && Settings.LICENSE.licenseType != "Open Source License")) {
                    return this;
                }
                if (Settings.LICENSE != undefined && Settings.LICENSE.licenseType === "trial") {
                    var yourEpoch = parseFloat(Settings.LICENSE.expiration);
                    var yourDate = new Date(yourEpoch);
                    self.remainingdays = self.daydiff(new Date(), yourDate);


                    $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using a Saiku Enterprise" +
                        " Trial license, you have "+ self.remainingdays+" days remaining. <a href='http://www.meteorite.bi/saiku-pricing'>Buy licenses online.</a></div>");
                    return self;
                }
                else {
                    $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using Saiku Community" +
                        " Edition, please consider upgrading to <a target='_blank' href='http://meteorite.bi'>Saiku Enterprise</a>, or entering a <a href='http://meteorite.bi/products/saiku/sponsorship'>sponsorship agreement with us</a> to support development. " +
                        "<a href='http://meteorite.bi/products/saiku/community'>Or contribute by joining our community and helping other users!</a></div></div>");

                    return self;
                }
        }
        else {
                if(Saiku.session.get("notice") != undefined && Saiku.session.get("notice")!=null && Saiku.session.get("notice")!=""){
                    $(this.el).append("<div><div id='uphead' class='upgradeheader'>Notice:"+Saiku.session.get("notice")+"</div>");

                }
                if (Settings.LICENSE.licenseType != undefined && (Settings.LICENSE.licenseType != "trial" &&
                    Settings.LICENSE.licenseType != "Open Source License")) {
                    return this;
                }
                if (Settings.LICENSE.licenseType === "trial") {
                    var yourEpoch = parseFloat(Settings.LICENSE.expiration);
                    var yourDate = new Date(yourEpoch);

                    self.remainingdays = self.daydiff(new Date(), yourDate);

                    $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using a Saiku Enterprise" +
                        " Trial license, you have "+ self.remainingdays+" days remaining. <a href='http://www.meteorite.bi/saiku-pricing'>Buy licenses online.</a></div>");
                    return self;
                }
                else {
                    $(this.el).append("<div><div id='uphead' class='upgradeheader'>You are using Saiku Community" +
                        " Edition, please consider upgrading to <a target='_blank' href='http://meteorite.bi'>Saiku Enterprise</a>, or entering a <a href='http://meteorite.bi/products/saiku/sponsorship'>sponsorship agreement with us</a> to support development. " +
                        "<a href='http://meteorite.bi/products/saiku/community'>Or contribute by joining our community and helping other users!</a></div></div>");
                    return self;
                }
        }



*/




    },
  1. 去除登陆后的欢迎页面

a) saiku-server\tomcat\webapps\ROOT\js\saiku\views\SplashScreen.js

#修改成空白页 
template: function() {
        var template = $("");
        return _.template(template)({
            //    cube_navigation: Saiku.session.sessionworkspace.cube_navigation
        });

    }
  1. 文章参考
    http://www.cnblogs.com/avivaye/p/4877882.html

pay

猜你喜欢

转载自blog.csdn.net/yvigmmwfn/article/details/78914866