9. 安装 MMBase 附加应用程序

随着 1.7 版本的发布,MMBase 被改造成更模块化的结构。开发人员决定从 MMBase 树中取出几个模块(即 CloudContext SecurityMediaEmail),并将它们作为单独的实体提供。然而,目前 MMBase 根本没有模块接口。因此,要使用这些附加应用程序,需要将库和其他文件放置到安装树中,并且需要手动将配置添加到现有的配置文件中。

9.1. 安装 CloudContext Security 模块

>来自 MMBase 网站 (www.mmbase.org):

Cloud security 使用对象 mmbaseuser 来存储用于用户授权和身份验证的信息。此安全实施的两个主要优点是用户管理可以通过使用 Web 浏览器(而不是编辑文件系统上的文件)来执行,并且您的 MMBase 安装的用户可以作为云中的对象使用。例如,可以创建用户组,这些用户组被允许执行某些任务。”

“上下文由一组权限组成,这些权限描述了您可以在此上下文中对 MMBase 对象执行的操作。例如,您可以为站点的匿名访问者使用的上下文定义读取权限,并且您可以为站点的注册用户定义具有编辑权限的上下文。”

CloudContext Security 模块的库和其他文件移动到 MMBase 安装树中

  
  mv -i web-app/WEB-INF/lib/* \
      /usr/local/tomcat/webapps/mmbase-webapp/WEB-INF/lib/
  mv -i web-app/WEB-INF/config/applications/* \
      /usr/local/tomcat/webapps/mmbase-webapp/WEB-INF/config/applications/
  mv -i web-app/WEB-INF/config/builders/* \
      /usr/local/tomcat/webapps/mmbase-webapp/WEB-INF/config/builders/
  
  

保存文档文件以供日后参考

  
  mv -i web-app/README.txt web-app/README-PACKAGE.txt web-app/documentation web-app/src \
      /usr/local/tomcat/webapps/mmbase-webapp/mmdocs/security/
  
  

确保所有这些新文件也归您的 tomcat 用户所有

  
  chown -R tomcat:tomcat /usr/local/tomcat/webapps/mmbase-webapp
  
  

禁用安全配置文件中的现有配置/usr/local/tomcat/webapps/mmbase-webapp/WEB-INF/config/security/security.xml:

  
  <!--
  <authentication class="org.mmbase.security.implementation.context.ContextAuthentication" url="context/config.xml" />
  -->
  ...
  <!--
  <authorization class="org.mmbase.security.implementation.context.ContextAuthorization" url="context/config.xml" />
  -->
  
  

并添加 (来自web-app/WEB-INF/config/security/security.xml):

  
  <!--
  Example security.xml to switch on Cloud Context Security.
  No other configuration needed
  (Cloud Context Security is configured in the cloud)
  @version $Id: security.xml,v 1.1 2003/06/17 16:44:01 michiel Exp $
  -->
  <authentication class="org.mmbase.security.implementation.cloudcontext.Authenticate" url="" />
  <authorization  class="org.mmbase.security.implementation.cloudcontext.Verify"       url="" />
  
  

Note

确保将上述配置包含在之前<sharedsecret>语句之前,否则您将收到如下错误

  
  ERROR org.mmbase.util.XMLErrorHandler - security.xml line:71 column:12:
      The content of element type "security" must match "(authentication,authorization,sharedsecret)".
  
  

9.2. 安装 Media 模块

<TODO>

9.3. 安装 Email 模块

Email 模块使得可以使用 MMBase 发送电子邮件,可以使用 SendMailJMSendMail

Email 模块的库和其他文件移动到 MMBase 安装树中

  
  mv -i web-app/WEB-INF/lib/* \
      /usr/local/tomcat/webapps/mmbase-webapp/WEB-INF/lib/
  mv -i web-app/WEB-INF/config/builders/* \
      /usr/local/tomcat/webapps/mmbase-webapp/WEB-INF/config/builders/
  mkdir /usr/local/tomcat/webapps/mmbase-webapp/email-examples/
  cp -iR web-app/examples/* \
      /usr/local/tomcat/webapps/mmbase-webapp/email-examples/
  
  

保存文档文件以供日后参考

  
  mkdir /usr/local/tomcat/webapps/mmbase-webapp/mmdocs/email/
  mv -i web-app/README.txt web-app/README-PACKAGE.txt web-app/documentation web-app/src \
      /usr/local/tomcat/webapps/mmbase-webapp/mmdocs/email/
  
  

确保所有这些新文件也归您的 tomcat 用户所有

  
  chown -R tomcat:tomcat /usr/local/tomcat/webapps/mmbase-webapp
  
  

编辑电子邮件配置文件/usr/local/tomcat/webapps/mmbase-webapp/WEB-INF/config/modules/sendmail.xml(来自web-app/WEB-INF/config/modules/sendmail.xml):

  
  ...
  <status>active</status>
  ...
  <classfile>org.mmbase.applications.email.SendMail</classfile>
  ...
  
  

添加到 Tomcat 的根目录Context(对于 Tomcat 版本 5,在 /usr/local/tomcat/conf/context.xml 中;对于 Tomcat 版本 4,在 /usr/local/tomcat/conf/server.xml 中)(将 <smtp.domain.tld> 替换为您的 SMTP 服务器地址)

  
  Resource name="mail/Session" auth="Container"
           type="javax.mail.Session"/>
    <ResourceParams name="mail/Session">
      <parameter>
        <name>mail.smtp.host</name>
        <value>smtp.domain.tld</value>
      </parameter>
    </ResourceParams>
    <ResourceLink name="linkToGlobalResource"
                  global="simpleValue"
                  type="java.lang.Integer"/>
  
  

未能执行此操作将导致致命错误

  
  FATAL org.mmbase.module.JMSendMail -
      JMSendMail failure: Name mail is not bound in this Context
  
  

Warning

Tomcat 版本 5 上运行的 MMBase 版本 1.7 中安装 Email 模块导致致命错误

  
  FATAL org.mmbase.servlet.MMBaseStartThread -
  Could not find the MMBase module!javax/mail/Session