代码之家  ›  专栏  ›  技术社区  ›  jb.

煤层2.0至2.1(2.2)的迁移

  •  3
  • jb.  · 技术社区  · 16 年前

    我很好奇,在将我的应用程序从seam 2.0迁移到2.1时,你遇到了什么样的障碍。

    migration guide

    首先,我想发布我在迁移方面的问题和解决方案的描述,这样人们就可以从中受益(我在网上没有找到任何解决方案)——我会把它作为答案发布:)

    2 回复  |  直到 16 年前
        1
  •  2
  •   Elmar Weber    16 年前

    如前所述,安全处理已更改(请参阅Seam发行版中的migration.txt)。

    此外,构建架构发生了巨大变化。如果使用生成的build.xml,则应重新生成它并手动重做所做的更改。其他一些与构建相关的工件也是如此,一些文件现在依赖于配置文件,可部署的库在部署的jars-ear/war.list中指定。最简单的方法是在两个生成的项目之间进行合并,这样的更改非常明显。

        2
  •  2
  •   Donald Duck user7392049    9 年前

    RuleBasedIdentity

    RuleBasedPermissionResolver .

      If you are using rule-based security in your project, the configuration for the 
      security rules in components.xml has changed.  Previously, the rules were configured
      as a property of the Identity component as such:
    
        <security:identity security-rules="#{securityRules}" authenticate-method="#{authenticator.authenticate}"/>
    
      In Seam 2.1, rule-based permission checks are now carried out by the RuleBasedPermissionResolver,
      requiring that it is configured with the security rules instead of Identity:
    
        <security:rule-based-permission-resolver security-rules="#{securityRules}"/>
    

    RuleBasedPermissionResolver.instance()

    Object String .

    c : PermissionCheck( name == 'fooHome' , action == "edit", granted == false )
    

    与:

    c : PermissionCheck( target == 'fooHome' , action == "edit", granted == false )
    

    如果你使用regexps:

    c : PermissionCheck( name matches "\w*List")
    

    c : PermissionCheck( target.toString matches "\w*List")
    

    Identity.hasPermission

    Identity.hasPermissio(String name, String action, Object... args)

    hasPermission PermissionCheck with name

    Identity.hasPermission("fooHome", "edit", fooInstance) 将导致权限检查,该检查符合以下规则:

    rule foo
        when
        c : PermissionCheck( name == "fooHome", action == "edit")
        f : Foo()
        then
        ...
    end
    

     public boolean hasPermission(String name, String action, Object...arg)
         {      
            if (!securityEnabled) return true;
            if (systemOp != null && Boolean.TRUE.equals(systemOp.get())) return true;   
            if (permissionMapper == null) return false;
    
            if (arg != null)
            {
          return permissionMapper.resolvePermission(arg[0], action);
            }
            else
            {
          return permissionMapper.resolvePermission(name, action);
            }
         }
    

    PermissionCheck

    rule foo
      when
      f : Foo()
      c : PermissionCheck( target = f, action == "edit")
    
      then
       ...
    end