Permalink
Browse files

release 1.0.4-b1

  • Loading branch information...
1 parent dfdae20 commit 7313515f47ff2f0b4b01988b36e3d5b93a0f1d87 @rkrzewski rkrzewski committed Jan 22, 2010
Showing with 4,918 additions and 0 deletions.
  1. +6 −0 coral-browser/.checkstyle
  2. +5 −0 coral-browser/.cvsignore
  3. +28 −0 coral-browser/LICENSE.txt
  4. +3 −0 coral-browser/findbugsExclude.xml
  5. +35 −0 coral-browser/maven.xml
  6. +56 −0 coral-browser/pom.xml
  7. +35 −0 coral-browser/project.properties
  8. +62 −0 coral-browser/project.xml
  9. +90 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddAttribute.java
  10. +50 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddPermission.java
  11. +56 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddPermissionToClass.java
  12. +49 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddRelation.java
  13. +59 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddRelationPair.java
  14. +126 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddResource.java
  15. +52 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddRole.java
  16. +54 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddSubRole.java
  17. +55 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddSuperRole.java
  18. +70 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/AddToResourceList.java
  19. +20 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/BaseBrowserAction.java
  20. +58 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteAttribute.java
  21. +58 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeletePermission.java
  22. +49 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteRelation.java
  23. +61 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteRelationPair.java
  24. +62 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteResource.java
  25. +63 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteResourceClass.java
  26. +53 −0 ...-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteResourceRecursive.java
  27. +63 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteRole.java
  28. +62 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/DeleteSubject.java
  29. +61 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/ExecuteCommand.java
  30. +58 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/GrantPermission.java
  31. +56 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/GrantRole.java
  32. +70 −0 ...l-browser/src/main/java/org/objectledge/coral/modules/actions/browser/RemoveFromResourceList.java
  33. +59 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/RevokePermission.java
  34. +55 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/RevokeRole.java
  35. +61 −0 coral-browser/src/main/java/org/objectledge/coral/modules/actions/browser/UploadScript.java
  36. +24 −0 ...-browser/src/main/java/org/objectledge/coral/modules/components/browser/BaseBrowserComponent.java
  37. +58 −0 coral-browser/src/main/java/org/objectledge/coral/modules/components/browser/PermissionList.java
  38. +58 −0 coral-browser/src/main/java/org/objectledge/coral/modules/components/browser/RelationList.java
  39. +57 −0 coral-browser/src/main/java/org/objectledge/coral/modules/components/browser/ResourceClassList.java
  40. +56 −0 coral-browser/src/main/java/org/objectledge/coral/modules/components/browser/ResourceTree.java
  41. +58 −0 coral-browser/src/main/java/org/objectledge/coral/modules/components/browser/RoleList.java
  42. +58 −0 coral-browser/src/main/java/org/objectledge/coral/modules/components/browser/SubjectList.java
  43. +37 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/Browser.java
  44. +45 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/AddAttribute.java
  45. +47 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/AddResource.java
  46. +49 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/AttributeDetails.java
  47. +26 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/BaseBrowserView.java
  48. +57 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/ChoosePermission.java
  49. +64 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/ChooseResource.java
  50. +56 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/ChooseResourceClass.java
  51. +56 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/ChooseRole.java
  52. +56 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/ChooseSubject.java
  53. +25 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/Default.java
  54. +45 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/PermissionView.java
  55. +45 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/RelationView.java
  56. +46 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/ResourceClassView.java
  57. +44 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/ResourceView.java
  58. +44 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/RoleView.java
  59. +43 −0 coral-browser/src/main/java/org/objectledge/coral/modules/views/browser/SubjectView.java
  60. +9 −0 coral-browser/src/main/resources/content/script/Browser.js
  61. +352 −0 coral-browser/src/main/resources/content/style/browser.css
  62. +30 −0 coral-browser/src/main/resources/templates/common/browser.vt
  63. +21 −0 coral-browser/src/main/resources/templates/components/browser/Navigation.vt
  64. +14 −0 coral-browser/src/main/resources/templates/components/browser/PermissionList.vt
  65. +14 −0 coral-browser/src/main/resources/templates/components/browser/RelationList.vt
  66. +14 −0 coral-browser/src/main/resources/templates/components/browser/ResourceClassList.vt
  67. +22 −0 coral-browser/src/main/resources/templates/components/browser/ResourceTree.vt
  68. +14 −0 coral-browser/src/main/resources/templates/components/browser/RoleList.vt
  69. +14 −0 coral-browser/src/main/resources/templates/components/browser/SubjectList.vt
  70. +10 −0 coral-browser/src/main/resources/templates/views/browser/AccessDenied.vt
  71. +21 −0 coral-browser/src/main/resources/templates/views/browser/AccessError.vt
  72. +64 −0 coral-browser/src/main/resources/templates/views/browser/AddAttribute.vt
  73. +130 −0 coral-browser/src/main/resources/templates/views/browser/AddResource.vt
  74. +123 −0 coral-browser/src/main/resources/templates/views/browser/AttributeDetails.vt
  75. +14 −0 coral-browser/src/main/resources/templates/views/browser/AuthError.vt
  76. +24 −0 coral-browser/src/main/resources/templates/views/browser/ChoosePermission.vt
  77. +32 −0 coral-browser/src/main/resources/templates/views/browser/ChooseResource.vt
  78. +25 −0 coral-browser/src/main/resources/templates/views/browser/ChooseResourceClass.vt
  79. +24 −0 coral-browser/src/main/resources/templates/views/browser/ChooseRole.vt
  80. +24 −0 coral-browser/src/main/resources/templates/views/browser/ChooseSubject.vt
  81. +12 −0 coral-browser/src/main/resources/templates/views/browser/ClosePopup.vt
  82. +24 −0 coral-browser/src/main/resources/templates/views/browser/Console.vt
  83. +17 −0 coral-browser/src/main/resources/templates/views/browser/Default.vt
  84. +23 −0 coral-browser/src/main/resources/templates/views/browser/Error.vt
  85. +15 −0 coral-browser/src/main/resources/templates/views/browser/LoginRequired.vt
  86. +68 −0 coral-browser/src/main/resources/templates/views/browser/PermissionView.vt
  87. +105 −0 coral-browser/src/main/resources/templates/views/browser/RelationView.vt
  88. +183 −0 coral-browser/src/main/resources/templates/views/browser/ResourceClassView.vt
  89. +142 −0 coral-browser/src/main/resources/templates/views/browser/ResourceView.vt
  90. +185 −0 coral-browser/src/main/resources/templates/views/browser/RoleView.vt
  91. +79 −0 coral-browser/src/main/resources/templates/views/browser/SubjectView.vt
  92. BIN coral-browser/xdocs/images/caltha-logo.gif
  93. +18 −0 coral-browser/xdocs/index.xml
  94. +14 −0 coral-browser/xdocs/navigation.xml
  95. +24 −0 coral-browser/xdocs/style/project.css
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?><fileset-config file-format-version="1.1.0" simple-config="false">
+<fileset name="main sources" check-config-name="Ledge checks" enabled="false"><file-match-pattern match-pattern="main.*java$" include-pattern="true"/>
+</fileset>
+<fileset name="test sources" check-config-name="Ledge test checks" enabled="false"><file-match-pattern match-pattern="test.*java$" include-pattern="true"/>
+</fileset>
+</fileset-config>
View
@@ -0,0 +1,5 @@
+bin
+target
+.clover
+*.log*
+build.properties
View
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2003, Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
+// All rights reserved.
+//
+// Redistribution and use in source and binary forms, with or without modification,
+// are permitted provided that the following conditions are met:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimer in the documentation
+// and/or other materials provided with the distribution.
+// * Neither the name of the Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
+// nor the names of its contributors may be used to endorse or promote products
+// derived from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+// OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+// POSSIBILITY OF SUCH DAMAGE.
+//
+
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<FindBugsFilter>
+</FindBugsFilter>
View
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<!--
+ Copyright (c) 2003, Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without modification,
+ are permitted provided that the following conditions are met:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+ * Neither the name of the Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
+ nor the names of its contributors may be used to endorse or promote products
+ derived from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+ OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+-->
+
+<!-- $Id: maven.xml,v 1.4 2004-05-13 14:09:54 fil Exp $ -->
+<project xmlns:j="jelly:core"
+ xmlns:ant="jelly:ant">
+
+</project>
View
@@ -0,0 +1,56 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+ http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.objectledge.coral</groupId>
+ <artifactId>coral-common</artifactId>
+ <relativePath>../coral-common/pom.xml</relativePath>
+ <version>1.0.4-b1</version>
+ </parent>
+ <artifactId>coral-browser</artifactId>
+ <packaging>jar</packaging>
+ <name>Coral Browser Web Module</name>
+ <dependencies>
+ <dependency>
+ <groupId>org.objectledge.coral</groupId>
+ <artifactId>coral-web</artifactId>
+ </dependency>
+ </dependencies>
+ <build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <excludes>
+ <exclude>content/**</exclude>
+ </excludes>
+ </resource>
+ </resources>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <dependencies>
+ <dependency>
+ <groupId>org.objectledge</groupId>
+ <artifactId>ledge-maven-assemblies</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ </dependencies>
+ <executions>
+ <execution>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ <configuration>
+ <descriptors>
+ <descriptor>content-war.xml</descriptor>
+ </descriptors>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,35 @@
+# Copyright (c) 2003, Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without modification,
+# are permitted provided that the following conditions are met:
+#
+# * Redistributions of source code must retain the above copyright notice,
+# this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following disclaimer in the documentation
+# and/or other materials provided with the distribution.
+# * Neither the name of the Caltha - Gajda, Krzewski, Mach, Potempski Sp.J.
+# nor the names of its contributors may be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+# INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# project.properties for coral-api
+#
+# $Id: project.properties,v 1.1 2004-10-14 04:44:01 rafal Exp $
+
+# multiproject
+maven.multiproject.type=jar
+
+# parent project
+coralCommon=../coral-common
View
@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="ISO-8859-2"?>
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>${coralCommon}/project.xml</extend>
+
+ <name>Coral browser</name>
+ <id>coral-browser</id>
+ <groupId>coral</groupId>
+ <currentVersion>${versions.coral}</currentVersion>
+ <shortDescription>
+ Coral Browser is a simple web application that allows viewing and modifying Coral
+ data schema, security settings, and resources.
+ </shortDescription>
+
+ <dependencies>
+ <dependency>
+ <groupId>coral</groupId>
+ <artifactId>coral-api</artifactId>
+ <version>${versions.coral}</version>
+ <url>http://coral.objectledge.org/modules/coral-api/</url>
+ </dependency>
+ <dependency>
+ <groupId>coral</groupId>
+ <artifactId>coral-web</artifactId>
+ <version>${versions.coral}</version>
+ <url>http://coral.objectledge.org/modules/coral-web/</url>
+ </dependency>
+ <dependency>
+ <groupId>coral</groupId>
+ <artifactId>coral-datatypes</artifactId>
+ <version>${versions.coral}</version>
+ <url>http://coral.objectledge.org/modules/coral-datatypes/</url>
+ </dependency>
+ <dependency>
+ <groupId>dna</groupId>
+ <artifactId>dna-api</artifactId>
+ <version>1.1-rc2</version>
+ <url>http://dna.codehaus.org</url>
+ </dependency>
+ <dependency>
+ <groupId>objectledge</groupId>
+ <artifactId>ledge-components</artifactId>
+ <version>${versions.ledge}</version>
+ </dependency>
+ <dependency>
+ <groupId>objectledge</groupId>
+ <artifactId>ledge-web</artifactId>
+ <version>${versions.ledge}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <sourceDirectory>src/main/java</sourceDirectory>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ </resource>
+ </resources>
+ <unitTestSourceDirectory>src/test/java</unitTestSourceDirectory>
+ </build>
+
+</project>
@@ -0,0 +1,90 @@
+package org.objectledge.coral.modules.actions.browser;
+
+import org.jcontainer.dna.Logger;
+import org.objectledge.context.Context;
+import org.objectledge.coral.schema.AttributeClass;
+import org.objectledge.coral.schema.AttributeDefinition;
+import org.objectledge.coral.schema.AttributeFlags;
+import org.objectledge.coral.schema.ResourceClass;
+import org.objectledge.coral.session.CoralSession;
+import org.objectledge.parameters.Parameters;
+import org.objectledge.pipeline.ProcessingException;
+import org.objectledge.templating.TemplatingContext;
+import org.objectledge.web.mvc.MVCContext;
+import org.objectledge.web.mvc.security.PolicySystem;
+
+/**
+ * Add attribute action.
+ *
+ * @author <a href="mailo:pablo@caltha.pl">Pawel Potempski</a>
+ * @version $Id: AddAttribute.java,v 1.3 2005-05-24 05:40:28 pablo Exp $
+ */
+public class AddAttribute extends BaseBrowserAction
+{
+ public AddAttribute(PolicySystem policySystemArg, Logger logger)
+ {
+ super(policySystemArg, logger);
+ }
+
+ /**
+ * Runns the valve.
+ *
+ * @param context the context.
+ */
+ public void execute(Context context, Parameters parameters, MVCContext mvcContext, TemplatingContext templatingContext, CoralSession coralSession)
+ throws ProcessingException
+ {
+ try
+ {
+ String attrName = parameters.get("attr_name", "");
+ if (attrName.length() == 0)
+ {
+ throw new ProcessingException("Attribute name not found");
+ }
+ long resClassId = parameters.getLong("res_class_id", -1L);
+ if (resClassId == -1L)
+ {
+ throw new ProcessingException("Resource class id not found");
+ }
+ long attrClassId = parameters.getLong("attr_class_id", -1L);
+ if (attrClassId == -1L)
+ {
+ throw new ProcessingException("Attribute class id not found");
+ }
+ boolean setDomain = parameters.getBoolean("set_domain", false);
+ String domain = null;
+ if (setDomain)
+ {
+ domain = parameters.get("domain", "");
+ }
+ boolean setValue = parameters.getBoolean("set_value", false);
+ String value = parameters.get("value", "");
+ String[] keys = parameters.getParameterNames();
+ int flags = 0;
+ for (int i = 0; i < keys.length; i++)
+ {
+ if (keys[i].startsWith("flag_"))
+ {
+ String flagName = keys[i].substring(5, keys[i].length());
+ flags = flags + AttributeFlags.flagValue(flagName);
+ }
+ }
+ AttributeClass attrClass = coralSession.getSchema().getAttributeClass(attrClassId);
+ AttributeDefinition attrDefinition = coralSession.getSchema().createAttribute(attrName, attrClass, domain, flags);
+ ResourceClass resourceClass = coralSession.getSchema().getResourceClass(resClassId);
+ Object defaultValue = null;
+ if (setValue)
+ {
+ defaultValue = attrClass.getHandler().toAttributeValue(value);
+ }
+ coralSession.getSchema().addAttribute(resourceClass, attrDefinition, defaultValue);
+ }
+ catch (Exception e)
+ {
+ logger.error("ARLException: ", e);
+ templatingContext.put("result", "exception");
+ return;
+ }
+ templatingContext.put("result", "added_successfully");
+ }
+}
@@ -0,0 +1,50 @@
+package org.objectledge.coral.modules.actions.browser;
+
+import org.jcontainer.dna.Logger;
+import org.objectledge.context.Context;
+import org.objectledge.coral.session.CoralSession;
+import org.objectledge.parameters.Parameters;
+import org.objectledge.pipeline.ProcessingException;
+import org.objectledge.templating.TemplatingContext;
+import org.objectledge.web.mvc.MVCContext;
+import org.objectledge.web.mvc.security.PolicySystem;
+
+/**
+ * Add role action.
+ *
+ * @author <a href="mailo:pablo@caltha.pl">Pawel Potempski</a>
+ * @version $Id: AddPermission.java,v 1.3 2005-05-24 05:40:28 pablo Exp $
+ */
+public class AddPermission extends BaseBrowserAction
+{
+ public AddPermission(PolicySystem policySystemArg, Logger logger)
+ {
+ super(policySystemArg, logger);
+ }
+
+ /**
+ * Performs the action.
+ */
+ public void execute(Context context, Parameters parameters, MVCContext mvcContext, TemplatingContext templatingContext, CoralSession coralSession)
+ throws ProcessingException
+ {
+ try
+ {
+ String permissionName = parameters.get("permission_name", "");
+ if (permissionName.length() == 0)
+ {
+ templatingContext.put("result", "invalid_name");
+ return;
+ }
+ coralSession.getSecurity().createPermission(permissionName);
+ }
+ catch (Exception e)
+ {
+ logger.error("ARLException: ", e);
+ //templatingContext.put("trace",StringUtils.stackTrace(e));
+ templatingContext.put("result", "exception");
+ return;
+ }
+ templatingContext.put("result", "added_successfully");
+ }
+}
Oops, something went wrong.

0 comments on commit 7313515

Please sign in to comment.