You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by en...@apache.org on 2011/05/02 00:46:49 UTC
svn commit: r1098430 [1/4] - in /sling/trunk/samples: ./ accessmanager-ui/
accessmanager-ui/.settings/ accessmanager-ui/src/
accessmanager-ui/src/main/ accessmanager-ui/src/main/java/
accessmanager-ui/src/main/resources/ accessmanager-ui/src/main/resou...
Author: enorman
Date: Sun May 1 22:46:46 2011
New Revision: 1098430
URL: http://svn.apache.org/viewvc?rev=1098430&view=rev
Log:
SLING-1562, SLING-2065 added sample ui for usermanager and accessmanager
Added:
sling/trunk/samples/accessmanager-ui/
sling/trunk/samples/accessmanager-ui/.classpath (with props)
sling/trunk/samples/accessmanager-ui/.project (with props)
sling/trunk/samples/accessmanager-ui/.settings/
sling/trunk/samples/accessmanager-ui/.settings/org.eclipse.jdt.core.prefs
sling/trunk/samples/accessmanager-ui/README.txt (with props)
sling/trunk/samples/accessmanager-ui/pom.xml (with props)
sling/trunk/samples/accessmanager-ui/src/
sling/trunk/samples/accessmanager-ui/src/main/
sling/trunk/samples/accessmanager-ui/src/main/java/
sling/trunk/samples/accessmanager-ui/src/main/resources/
sling/trunk/samples/accessmanager-ui/src/main/resources/SLING-INF/
sling/trunk/samples/accessmanager-ui/src/main/resources/SLING-INF/i18n/
sling/trunk/samples/accessmanager-ui/src/main/resources/SLING-INF/i18n/resources.json
sling/trunk/samples/accessmanager-ui/src/main/resources/css/
sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/
sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.css (with props)
sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.min.css (with props)
sling/trunk/samples/accessmanager-ui/src/main/resources/images/
sling/trunk/samples/accessmanager-ui/src/main/resources/images/gradient.png (with props)
sling/trunk/samples/accessmanager-ui/src/main/resources/images/sling-logo.png (with props)
sling/trunk/samples/accessmanager-ui/src/main/resources/images/ui-anim_basic_16x16.gif (with props)
sling/trunk/samples/accessmanager-ui/src/main/resources/js/
sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/
sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.js (with props)
sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.min.js (with props)
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/page.html.esp
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/sidebar.html.esp
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace.html.esp
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace_body.html.esp
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/acl.html.esp
sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/acl_body.html.esp
sling/trunk/samples/usermanager-ui/
sling/trunk/samples/usermanager-ui/.classpath (with props)
sling/trunk/samples/usermanager-ui/.project (with props)
sling/trunk/samples/usermanager-ui/.settings/
sling/trunk/samples/usermanager-ui/.settings/org.eclipse.jdt.core.prefs
sling/trunk/samples/usermanager-ui/README.txt (with props)
sling/trunk/samples/usermanager-ui/pom.xml (with props)
sling/trunk/samples/usermanager-ui/src/
sling/trunk/samples/usermanager-ui/src/main/
sling/trunk/samples/usermanager-ui/src/main/java/
sling/trunk/samples/usermanager-ui/src/main/java/org/
sling/trunk/samples/usermanager-ui/src/main/java/org/apache/
sling/trunk/samples/usermanager-ui/src/main/java/org/apache/sling/
sling/trunk/samples/usermanager-ui/src/main/java/org/apache/sling/usermgr/
sling/trunk/samples/usermanager-ui/src/main/java/org/apache/sling/usermgr/FindPeopleQuery.java (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/
sling/trunk/samples/usermanager-ui/src/main/resources/SLING-INF/
sling/trunk/samples/usermanager-ui/src/main/resources/SLING-INF/i18n/
sling/trunk/samples/usermanager-ui/src/main/resources/SLING-INF/i18n/resources.json
sling/trunk/samples/usermanager-ui/src/main/resources/css/
sling/trunk/samples/usermanager-ui/src/main/resources/css/usermanager/
sling/trunk/samples/usermanager-ui/src/main/resources/css/usermanager/usermanager.css (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/css/usermanager/usermanager.min.css (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/images/
sling/trunk/samples/usermanager-ui/src/main/resources/images/ajax-loader.gif (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/images/gradient.png (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/images/sling-logo.png (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/images/ui-anim_basic_16x16.gif (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/js/
sling/trunk/samples/usermanager-ui/src/main/resources/js/usermanager/
sling/trunk/samples/usermanager-ui/src/main/resources/js/usermanager/usermanager.js (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/js/usermanager/usermanager.min.js (with props)
sling/trunk/samples/usermanager-ui/src/main/resources/libs/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/group/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/group/html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/group/update_body.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/groups/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/groups/body.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/groups/create.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/groups/create_body.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/groups/html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/groups/searchresult.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/user/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/user/html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/user/update_body.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/userManager/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/userManager/autocomplete.json.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/userManager/body.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/userManager/html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/userManager/searchresult.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/usermgmt/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/usermgmt/page.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/usermgmt/sidebar.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/users/
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/users/body.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/users/create.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/users/create_body.html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/users/html.esp
sling/trunk/samples/usermanager-ui/src/main/resources/libs/sling/users/searchresult.html.esp
Modified:
sling/trunk/samples/pom.xml
Added: sling/trunk/samples/accessmanager-ui/.classpath
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/.classpath?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/.classpath (added)
+++ sling/trunk/samples/accessmanager-ui/.classpath Sun May 1 22:46:46 2011
@@ -0,0 +1,9 @@
+<classpath>
+ <classpathentry kind="src" path="src/main/java" including="**/*.java"/>
+ <classpathentry kind="src" path="src/main/resources" excluding="**/*.java"/>
+ <classpathentry kind="src" path="target/maven-shared-archive-resources" excluding="**/*.java"/>
+ <classpathentry kind="output" path="target/classes"/>
+ <classpathentry kind="var" path="M2_REPO/javax/jcr/jcr/1.0/jcr-1.0.jar"/>
+ <classpathentry kind="var" path="M2_REPO/org/apache/jackrabbit/jackrabbit-api/2.2.5/jackrabbit-api-2.2.5.jar"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+</classpath>
\ No newline at end of file
Propchange: sling/trunk/samples/accessmanager-ui/.classpath
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/.project
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/.project?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/.project (added)
+++ sling/trunk/samples/accessmanager-ui/.project Sun May 1 22:46:46 2011
@@ -0,0 +1,13 @@
+<projectDescription>
+ <name>org.apache.sling.samples.accessmanager.ui</name>
+ <comment>Sample Sling UI for access management operations. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+ <projects/>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
\ No newline at end of file
Propchange: sling/trunk/samples/accessmanager-ui/.project
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/.settings/org.eclipse.jdt.core.prefs
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/.settings/org.eclipse.jdt.core.prefs?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/.settings/org.eclipse.jdt.core.prefs (added)
+++ sling/trunk/samples/accessmanager-ui/.settings/org.eclipse.jdt.core.prefs Sun May 1 22:46:46 2011
@@ -0,0 +1,11 @@
+#Sun Apr 25 16:53:23 PDT 2010
+encoding//src/main/java=UTF-8
+encoding//target/scr-plugin-generated=UTF-8
+org.eclipse.jdt.core.compiler.compliance=1.5
+encoding//target/maven-shared-archive-resources=UTF-8
+encoding//src/test/java=UTF-8
+encoding//src/test/resources=UTF-8
+encoding//src/main/resources=UTF-8
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.source=1.5
Added: sling/trunk/samples/accessmanager-ui/README.txt
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/README.txt?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/README.txt (added)
+++ sling/trunk/samples/accessmanager-ui/README.txt Sun May 1 22:46:46 2011
@@ -0,0 +1,50 @@
+Sling user management UI sample
+---------------------
+
+WHY THIS SAMPLE?
+----------------
+This demonstrates some sample UI for user self-regirstration and profile update.
+
+HOW TO INSTALL
+--------------
+Build this bundle and install it in Sling.
+
+For example, if Sling is running on port 8080 (which happens if you start
+the launchpad/testing module with "mvn jetty:run"), this will build and
+install it:
+
+ mvn -P autoInstallBundle clean install -Dsling.url=http://localhost:8080/system/console
+
+To verify that the bundle is correctly installed:
+
+1) http://localhost:8080/apps/espblog/html.esp must return the html.esp
+ script.
+
+2) The console at http://localhost:8080/system/console/bundles must
+ list the bundle named "Sling - ESP blog sample" as active.
+
+HOW TO TEST
+-----------
+Start by logging in at http://localhost:8080/?sling:authRequestLogin=true,
+using username=admin and password=admin (or use the "login" link on the
+/index.html page).
+
+Once logged in, /index.html should say "you are currently logged in as
+user "admin" to workspace "default".
+
+Then, http://localhost:8080/content/espblog/*.html should display the "Sling ESP
+blog sample" page, with the Home/Admin/New Post/... menu.
+
+If you get Sling's default HTML rendition instead ("Resource dumped by
+HtmlRendererServlet") that's probably because the "path-based-rtp" bundle
+is not installed. Run the above "mvn...clean install" command in the
+sling/samples/path-based-rtp folder to install it, and reload the page.
+
+Create a new post using the "New Post" menu.
+
+The post can include an attachment, if that's an image the included
+ThumbnailGeneratorService generates thumbnails in different sizes, displayed
+on the post's page. This happens asynchronously, so depending on your
+machine's speed the thumbnails might only appear after a few seconds.
+
+The ESP scripts are found under /apps/espblog in the repository.
Propchange: sling/trunk/samples/accessmanager-ui/README.txt
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/pom.xml?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/pom.xml (added)
+++ sling/trunk/samples/accessmanager-ui/pom.xml Sun May 1 22:46:46 2011
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="UTF-8"?>
+ <!--
+ Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for
+ additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not
+ use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by
+ applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
+ -->
+<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/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.sling</groupId>
+ <artifactId>sling</artifactId>
+ <version>9</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.apache.sling.samples</groupId>
+ <artifactId>org.apache.sling.samples.accessmanager.ui</artifactId>
+ <packaging>bundle</packaging>
+ <version>0.9-SNAPSHOT</version>
+ <name>Apache Sling Access Manager UI sample</name>
+ <description>
+ Sample Sling UI for access management operations.
+ </description>
+
+ <scm>
+ <connection>scm:svn:http://svn.apache.org/repos/asf/sling/trunk/samples/accessmanager-ui</connection>
+ <developerConnection>scm:svn:https://svn.apache.org/repos/asf/sling/trunk/samples/accessmanager-ui</developerConnection>
+ <url>http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui</url>
+ </scm>
+
+ <pluginRepositories>
+ <!-- for yui-compressor-maven-plugin -->
+ <pluginRepository>
+ <name>oss.sonatype.org</name>
+ <id>oss.sonatype.org</id>
+ <url>http://oss.sonatype.org/content/groups/public</url>
+ </pluginRepository>
+ </pluginRepositories>
+
+ <build>
+ <plugins>
+ <!-- use the yui-compressor to minify the js and css files -->
+ <plugin>
+ <groupId>net.alchim31.maven</groupId>
+ <artifactId>yuicompressor-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>compress</goal>
+ </goals>
+ </execution>
+ </executions>
+ <configuration>
+ <sourceDirectory>${basedir}/src/main/resources</sourceDirectory>
+ <outputDirectory>${basedir}/src/main/resources</outputDirectory>
+ <suffix>.min</suffix>
+ <excludes>
+ <exclude>**/*.min.*</exclude>
+ </excludes>
+ <!--
+ <aggregations>
+ <aggregation>
+ <insertNewLine>true</insertNewLine>
+ <output>${basedir}/src/main/resources/js/usermgmt/usermgmt.all.min.js</output>
+ <includes>
+ <include>jquery/jquery-1.5.1.min.js</include>
+ <include>jquery/jquery-ui-1.8.11.custom.min.js</include>
+ <include>jquery/jquery-validate/jquery.validate.min.js</include>
+ <include>accessmanager.min.js</include>
+ </includes>
+ </aggregation>
+ <aggregation>
+ <insertNewLine>true</insertNewLine>
+ <output>${basedir}/src/main/resources/js/usermgmt/usermgmt.all.js</output>
+ <includes>
+ <include>jquery/jquery-1.5.1.min.js</include>
+ <include>jquery/jquery-ui-1.8.11.custom.min.js</include>
+ <include>jquery/jquery-validate/jquery.validate.js</include>
+ <include>accessmanager.js</include>
+ </includes>
+ </aggregation>
+ </aggregations>
+ -->
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-scr-plugin</artifactId>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Export-Package>
+ org.apache.sling.accessmanager
+ </Export-Package>
+ <Sling-Bundle-Resources>
+ /images,
+ /css/accessmanager,
+ /js/accessmanager,
+ /libs/sling/accessmanager,
+ /libs/sling/servlet
+ </Sling-Bundle-Resources>
+ <Sling-Initial-Content>
+ SLING-INF/i18n;overwrite:=false;uninstall:=false;path:=/etc/i18n/org.apache.sling.samples.accessmanager.ui
+ </Sling-Initial-Content>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <reporting>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-javadoc-plugin</artifactId>
+ <configuration>
+ <excludePackageNames></excludePackageNames>
+ </configuration>
+ </plugin>
+ </plugins>
+ </reporting>
+
+ <dependencies>
+ </dependencies>
+</project>
Propchange: sling/trunk/samples/accessmanager-ui/pom.xml
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/SLING-INF/i18n/resources.json
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/SLING-INF/i18n/resources.json?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/SLING-INF/i18n/resources.json (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/SLING-INF/i18n/resources.json Sun May 1 22:46:46 2011
@@ -0,0 +1,242 @@
+{
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+ "en": {
+ "jcr:mixinTypes": [
+ "mix:language"
+ ],
+ "jcr:language": "en",
+ "sling:basename": "org.apache.sling.accessmanager.Resources",
+
+ /* for the page template */
+
+ "page.template.title": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "page.template.title",
+ "sling:message": "{0} : Sling"
+ },
+ "msg.noscript": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "msg.noscript",
+ "sling:message": "Your browser has scripting disabled. Please enable scripting for a better experience."
+ },
+
+ "link.login": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "link.login",
+ "sling:message": "Login"
+ },
+ "link.logout": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "link.logout",
+ "sling:message": "Logout"
+ },
+ "logo.alt": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "logo.alt",
+ "sling:message": "Apache Sling"
+ },
+
+ /* for ACL page */
+
+ "page.title.acl": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "page.title.acl",
+ "sling:message": "Permissions"
+ },
+
+ "header.update.acl": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "header.update.acl",
+ "sling:message": "Update Permissions Of: {0}"
+ },
+
+ "header.view.acl": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "header.view.acl",
+ "sling:message": "View Permissions Of: {0}"
+ },
+
+ "msg.acl.empty": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "msg.acl.empty",
+ "sling:message": "No Declared Access Rights"
+ },
+
+ "column.authorizable.header": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "column.authorizable.header",
+ "sling:message": "User / Group"
+ },
+ "column.privileges.header": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "column.privileges.header",
+ "sling:message": "Privileges"
+ },
+
+ "dialog.title.confirm.remove": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "dialog.title.confirm.remove",
+ "sling:message": "Confirm Remove"
+ },
+ "msg.ace.confirm.remove": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "msg.ace.confirm.remove",
+ "sling:message": "Are you sure you want to delete this entry?"
+ },
+
+
+ /* for ACE page */
+ "label.ace.principalId": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.ace.principalId",
+ "sling:message": "Principal:"
+ },
+ "label.ace.order": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.ace.order",
+ "sling:message": "Order:"
+ },
+ "ace.order.option.default": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "ace.order.option.default",
+ "sling:message": "Default"
+ },
+ "ace.order.option.first": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "ace.order.option.first",
+ "sling:message": "First"
+ },
+ "ace.order.option.before": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "ace.order.option.before",
+ "sling:message": "Before {0}"
+ },
+ "ace.order.option.last": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "ace.order.option.last",
+ "sling:message": "Last"
+ },
+
+ "label.ace.privileges": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.ace.privileges",
+ "sling:message": "Privileges:"
+ },
+ "column.privilege.notset": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "column.privilege.notset",
+ "sling:message": "Not Set"
+ },
+ "column.privilege.granted": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "column.privilege.granted",
+ "sling:message": "Granted"
+ },
+ "column.privilege.denied": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "column.privilege.denied",
+ "sling:message": "Denied"
+ },
+
+ "label.privilege.jcr_all": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:all",
+ "sling:message": "Full Control"
+ },
+ "label.privilege.jcr_read": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:read",
+ "sling:message": "Read"
+ },
+ "label.privilege.jcr_write": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:write",
+ "sling:message": "Write"
+ },
+ "label.privilege.jcr_modifyProperties": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:modifyProperties",
+ "sling:message": "Modify Properties"
+ },
+ "label.privilege.jcr_removeNode": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:removeNode",
+ "sling:message": "Remove"
+ },
+ "label.privilege.jcr_addChildNodes": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:addChildNodes",
+ "sling:message": "Add Children"
+ },
+ "label.privilege.jcr_removeChildNodes": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:removeChildNodes",
+ "sling:message": "Remove Children"
+ },
+ "label.privilege.jcr_readAccessControl": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:readAccessControl",
+ "sling:message": "Read Permissions"
+ },
+ "label.privilege.jcr_modifyAccessControl": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "label.privilege.jcr:modifyAccessControl",
+ "sling:message": "Modify Permissions"
+ },
+
+ "button.save": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "button.save",
+ "sling:message": "Save"
+ },
+ "link.remove": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "link.remove",
+ "sling:message": "Remove"
+ },
+
+
+ /* for SideBar links */
+
+ "menu.link.view.acl": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "menu.link.view.acl",
+ "sling:message": "View Permissions"
+ },
+ "menu.link.update.acl": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "menu.link.update.acl",
+ "sling:message": "Update Permissions"
+ },
+ "menu.link.add.ace": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "menu.link.add.ace",
+ "sling:message": "Add Entry"
+ },
+ "menu.link.view.ace": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "menu.link.view.ace",
+ "sling:message": "View Entry"
+ },
+ "menu.link.update.ace": {
+ "jcr:primaryType": "sling:MessageEntry",
+ "sling:key": "menu.link.update.ace",
+ "sling:message": "Update Entry"
+ }
+ }
+}
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.css
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.css?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.css (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.css Sun May 1 22:46:46 2011
@@ -0,0 +1,317 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+body {
+ background-color: #ffffff;
+ color: #3b3b3b;
+ font-family: Tahoma, Arial, sans-serif;
+ font-size: 10pt;
+ line-height: 140%;
+ margin: 0;
+ padding: 0;
+}
+
+a {
+ color: #1980af;
+ text-decoration: none;
+}
+
+a:visited {
+ color: #1980af;
+}
+
+a:hover {
+ color: #1faae9;
+ text-decoration: underline;
+}
+
+img, a img
+{
+ border: none;
+}
+
+.title {
+ position: absolute;
+ left: 1px;
+ right: 1px;
+ top: 25px;
+ height: 81px;
+ background: url(../../images/gradient.png)
+ repeat-x;
+ background-position: bottom;
+}
+
+.logo {
+ position: absolute;
+ width: 15em;
+ height: 81px;
+ text-align: center;
+}
+
+.header {
+ text-align: right;
+ margin-right: 20pt;
+}
+
+.menu {
+ border-top: 10px solid #f9bb00;
+ position: absolute;
+ top: 107px;
+ left: 1px;
+ width: 15em;
+ bottom: 0px;
+ padding: 0px;
+ background-color: #fcfcfc
+}
+
+.menu ul {
+ background-color: #fdf5d9;
+ list-style: none;
+ padding-left: 0px;
+ margin-top: 0px;
+ padding-top: 2em;
+ padding-bottom: 2em;
+ margin-left: 0px;
+ color: #4a4a43
+}
+
+.menu ul li {
+ padding-left: 2.5em;
+ padding-top: 2px;
+ padding-bottom: 2px;
+}
+
+.menu ul li.ui-state-highlight {
+ font-weight: bold;
+}
+
+.menu a {
+ color: #4a4a43
+}
+
+.main {
+ position: absolute;
+ border-top: 10px solid #cde0ea;
+ top: 107px;
+ left: 15em;
+ right: 1px;
+ margin-left: 2px;
+ padding: 10px 10px;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Login/Logout Links ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#menu_login
+{
+ display: inline;
+ margin: 10px 20px;
+ font-size: 11px;
+ padding: 5px 7px;
+ position: absolute;
+ right: 0;
+ top: 0;
+ z-index: 10;
+}
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Access Manager Pages ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+.accessmgmt-body
+{
+ padding: 5px;
+}
+
+.accessmgmt-header
+{
+ font-size: 14px;
+ padding: 5px 10px;
+ margin: 0 0 10px 0;
+}
+
+.info-msg-block
+{
+ margin-left: 10px;
+ margin-right: 10px;
+ margin-bottom: 10px;
+}
+.info-msg-block p
+{
+ margin: 5px;
+}
+.info-msg-block span.ui-icon
+{
+ float: left;
+}
+.info-msg-text
+{
+ margin-left: 5px;
+}
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- ACL Page ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#add-ace-block
+{
+ float: right;
+ line-height: 33px;
+ padding-right: 10px;
+}
+
+#add-ace-block .ui-button-text-only .ui-button-text
+{
+ line-height: 1;
+ padding: 5px 5px;
+ font-size: 10pt;
+}
+
+#modify-acl-header
+{
+ margin-bottom: 5px;
+}
+
+#modify-acl-header h3
+{
+ font-size: 14px;
+ font-weight: bold;
+ display: inline;
+ line-height: 33px;
+}
+
+#acl-list-empty
+{
+ line-height: 100px;
+ font-size: large;
+ font-weight: bold;
+ text-align: center;
+}
+
+#acl-list td,
+#acl-list th
+{
+ padding: 5px;
+}
+
+#acl-list tr.odd
+{
+ background-color: #eee;
+}
+
+#acl-list form,
+#acl-list form div
+{
+ display: inline;
+}
+
+#acl-list .ui-button-text-only .ui-button-text {
+ line-height: 1;
+ padding: 5px 5px;
+ font-size: 10pt;
+}
+
+.prop-line
+{
+ margin-bottom: 5px;
+ line-height: 26px;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- ACE Page ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+#update-ace-form label
+{
+ float: left;
+ display: inline;
+ width: 15%;
+ text-align: right;
+}
+
+#update-ace-form button
+{
+ margin-left: 10px;
+}
+
+#update-ace-form input[type=text],
+#update-ace-form select
+{
+ margin-left: 10px;
+ width: 75%;
+}
+
+#ace-list {
+ position: relative;
+ left: 10px;
+ width: 75%;
+}
+
+#ace-list th,
+#ace-list td
+{
+ padding: 5px;
+}
+#ace-list tr.odd
+{
+ background-color: #eee;
+}
+
+#remove-ace-dialog fieldset
+{
+ border: none;
+ margin: 0;
+ padding: 0;
+ line-height: 20px;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Widget style tweaks ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+
+.ui-autocomplete-loading
+{
+ background: white url('../../images/ui-anim_basic_16x16.gif') right center no-repeat;
+}
+
+.noscript-hide
+{
+ display:none;
+}
+
+
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+/* --- Validation error styles ---*/
+/* ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
+input.error, textarea.error
+{
+ border: 1px dotted red;
+}
+
+label.error, label.error
+{
+ color: red;
+ font-style: italic;
+ font-weight: bold;
+ margin-left: 15%;
+ padding-left: 10px;
+ text-align: left !important;
+ width: auto !important;
+}
\ No newline at end of file
Propchange: sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.css
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.min.css
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.min.css?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.min.css (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.min.css Sun May 1 22:46:46 2011
@@ -0,0 +1,42 @@
+/*!* Licensed to the Apache Software Foundation(ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License,Version 2.0 *(the "License");you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing,software * distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ body{background-color:#fff;color:#3b3b3b;font-family:Tahoma,Arial,sans-serif;font-size:10pt;line-height:140%;margin:0;padding:0;}
+a{color:#1980af;text-decoration:none;}
+a:visited{color:#1980af;}
+a:hover{color:#1faae9;text-decoration:underline;}
+img,a img{border:none;}
+.title{position:absolute;left:1px;right:1px;top:25px;height:81px;background:url(../../images/gradient.png) repeat-x;background-position:bottom;}
+.logo{position:absolute;width:15em;height:81px;text-align:center;}
+.header{text-align:right;margin-right:20pt;}
+.menu{border-top:10px solid #f9bb00;position:absolute;top:107px;left:1px;width:15em;bottom:0;padding:0;background-color:#fcfcfc;}
+.menu ul{background-color:#fdf5d9;list-style:none;padding-left:0;margin-top:0;padding-top:2em;padding-bottom:2em;margin-left:0;color:#4a4a43;}
+.menu ul li{padding-left:2.5em;padding-top:2px;padding-bottom:2px;}
+.menu ul li.ui-state-highlight{font-weight:bold;}
+.menu a{color:#4a4a43;}
+.main{position:absolute;border-top:10px solid #cde0ea;top:107px;left:15em;right:1px;margin-left:2px;padding:10px 10px;}
+#menu_login{display:inline;margin:10px 20px;font-size:11px;padding:5px 7px;position:absolute;right:0;top:0;z-index:10;}
+.accessmgmt-body{padding:5px;}
+.accessmgmt-header{font-size:14px;padding:5px 10px;margin:0 0 10px 0;}
+.info-msg-block{margin-left:10px;margin-right:10px;margin-bottom:10px;}
+.info-msg-block p{margin:5px;}
+.info-msg-block span.ui-icon{float:left;}
+.info-msg-text{margin-left:5px;}
+#add-ace-block{float:right;line-height:33px;padding-right:10px;}
+#add-ace-block .ui-button-text-only .ui-button-text{line-height:1;padding:5px 5px;font-size:10pt;}
+#modify-acl-header{margin-bottom:5px;}
+#modify-acl-header h3{font-size:14px;font-weight:bold;display:inline;line-height:33px;}
+#acl-list-empty{line-height:100px;font-size:large;font-weight:bold;text-align:center;}
+#acl-list td,#acl-list th{padding:5px;}
+#acl-list tr.odd{background-color:#eee;}
+#acl-list form,#acl-list form div{display:inline;}
+#acl-list .ui-button-text-only .ui-button-text{line-height:1;padding:5px 5px;font-size:10pt;}
+.prop-line{margin-bottom:5px;line-height:26px;}
+#update-ace-form label{float:left;display:inline;width:15%;text-align:right;}
+#update-ace-form button{margin-left:10px;}
+#update-ace-form input[type=text],#update-ace-form select{margin-left:10px;width:75%;}
+#ace-list{position:relative;left:10px;width:75%;}
+#ace-list th,#ace-list td{padding:5px;}
+#ace-list tr.odd{background-color:#eee;}
+#remove-ace-dialog fieldset{border:none;margin:0;padding:0;line-height:20px;}
+.ui-autocomplete-loading{background:white url('../../images/ui-anim_basic_16x16.gif') right center no-repeat;}
+.noscript-hide{display:none;}
+input.error,textarea.error{border:1px dotted red;}
+label.error,label.error{color:red;font-style:italic;font-weight:bold;margin-left:15%;padding-left:10px;text-align:left!important;width:auto!important;}
\ No newline at end of file
Propchange: sling/trunk/samples/accessmanager-ui/src/main/resources/css/accessmanager/accessmanager.min.css
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/images/gradient.png
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/images/gradient.png?rev=1098430&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/samples/accessmanager-ui/src/main/resources/images/gradient.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/images/sling-logo.png
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/images/sling-logo.png?rev=1098430&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/samples/accessmanager-ui/src/main/resources/images/sling-logo.png
------------------------------------------------------------------------------
svn:mime-type = image/png
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/images/ui-anim_basic_16x16.gif
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/images/ui-anim_basic_16x16.gif?rev=1098430&view=auto
==============================================================================
Binary file - no diff available.
Propchange: sling/trunk/samples/accessmanager-ui/src/main/resources/images/ui-anim_basic_16x16.gif
------------------------------------------------------------------------------
svn:mime-type = image/gif
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.js
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.js?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.js (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.js Sun May 1 22:46:46 2011
@@ -0,0 +1,321 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Holds some common functions used by other access management objects
+ */
+AccessManager = {
+ /**
+ * Holds the servlet context path of the web application
+ */
+ contextPath: "",
+
+ /**
+ * Resource strings for usermgmt that can be localized for other languages
+ */
+ messages: {
+ "error.dlg.title": "Error",
+ "confirm.yes": "Yes",
+ "confirm.no": "No",
+ "button.add": "Add",
+
+ "tooltip.removeProperty": "Remove Property",
+ "tooltip.removeMember": "Remove Member",
+
+ "group.updated.msg": "Updated the group",
+ "user.updated.msg": "Updated the user",
+ "user.pwd.updated.msg": "Updated the password"
+ }
+};
+
+/**
+ * For the navigation links in the left side of the page.
+ */
+AccessManager.SideBar = {
+ /**
+ * Initialize SideBar elements
+ */
+ init: function() {
+ var i, navLinks, url, hash, nav;
+
+ // highlight the link for the current page
+ navLinks = $("ul#sidebar-nav li a");
+ url = location.href;
+ hash = location.hash;
+ if (hash != null && hash.length > 0) {
+ url = url.substring(0, url.length - hash.length);
+ }
+ for (i=0; i < navLinks.length; i++) {
+ nav = navLinks[i];
+ if (url == nav.href) {
+ $(nav.parentNode).addClass("ui-corner-all ui-state-highlight");
+ }
+ }
+ }
+};
+
+/**
+ * For showing an error dialog when something goes wrong.
+ */
+AccessManager.ErrorDlg = {
+ /**
+ * Show a modal dialog with the supplied content.
+ * @param {String} title The title text of the dialog
+ * @param {String} msg The html markup of the dialog body
+ */
+ showError: function(title, msg) {
+ // add an error_dialog div to the page if it doesn't already exist
+ if ($('#error_dialog').length == 0) {
+ $('body').append('<div id="error_dialog" style="display:none;"></div>');
+ }
+ //fill in the dialog body
+ $('#error_dialog').html( msg );
+ $('#error_dialog').dialog({
+ title: title,
+ bgiframe: true,
+ autoOpen: false,
+ width: 400,
+ maxHeight: 500,
+ modal: true
+ });
+ //show the modal dialog
+ $('#error_dialog').dialog('open');
+ },
+
+ /**
+ * Handles an error from an AJAX call by showing the error information
+ * in a modal dialog.
+ */
+ errorHandler: function( xmlHttpRequest, textStatus, errorThrown ) {
+ var title, obj;
+ try {
+ title = UserMgmt.messages["error.dlg.title"];
+ //see if the response is a JSON resoponse with an error field
+ obj = $.parseJSON(xmlHttpRequest.responseText);
+ if (obj.error) {
+ //found error field, so show the error message
+ UserMgmt.ErrorDlg.showError(title, obj.error.message);
+ } else {
+ //no error field, so show the whole response text
+ UserMgmt.ErrorDlg.showError(title, xmlHttpRequest.responseText);
+ }
+ } catch (e) {
+ //Not JSON? Show the whole response text.
+ UserMgmt.ErrorDlg.showError(title, xmlHttpRequest.responseText);
+ }
+ }
+};
+
+/**
+ * For pages the that view/modify the Access Control List
+ */
+AccessManager.Acl = {
+ /**
+ * Initializes the elements for the ACL page
+ */
+ init: function() {
+ //apply jquery-ui styles to the buttons
+ $("#acl-list button").button();
+
+ $("#acl-list tbody tr:odd").addClass("odd");
+
+ //attach a confirmation dialog to all the 'Remove' buttons
+ $('.remove-ace').click( function(e) {
+ var form = this.form;
+ //initialize the confirmation dialog
+ $("#remove-ace-dialog").dialog({
+ autoOpen: false,
+ height: 'auto',
+ width: 350,
+ modal: true,
+ resizable: false,
+ buttons: [
+ {
+ text: AccessManager.messages["confirm.yes"],
+ click: function() {
+ form.submit();
+ }
+ },
+ {
+ text: AccessManager.messages["confirm.no"],
+ click: function() {
+ $("#remove-ace-dialog").dialog("close");
+ }
+ }
+ ]
+ });
+
+ //show the dialog
+ $('#remove-ace-dialog').dialog('open');
+ return false;
+ });
+ }
+};
+
+/**
+ * For pages the that view/modify an Access Control Entry
+ */
+AccessManager.Ace = {
+ /**
+ * Initializes the elements for the ACE page
+ */
+ init: function() {
+ var m, form;
+ m = AccessManager.Ace;
+
+ $("#ace-list tbody tr:odd").addClass("odd");
+
+ //apply styles to the save button
+ $("#addAceSaveButton").button();
+
+ // validate form
+ form = $("#update-ace-form");
+ /*var validator = */form.validate({
+ rules: {
+ "principalId": "required"
+ }/*,
+ messages: {
+ }*/
+ });
+
+ var allGranted = $("input[name='privilege@jcr:all'][value=granted]:radio:checked");
+ var allDenied = $("input[name='privilege@jcr:all'][value=denied]:radio:checked");
+ if (allGranted.length > 0 || allDenied.length > 0) {
+ var value = allGranted.length > 0 ? "granted" : "denied";
+ m.setAggregatePrivilege("jcr:read", value);
+ m.setAggregatePrivilege("jcr:write", value);
+ m.setAggregatePrivilege("jcr:modifyProperties", value);
+ m.setAggregatePrivilege("jcr:removeNode", value);
+ m.setAggregatePrivilege("jcr:addChildNodes", value);
+ m.setAggregatePrivilege("jcr:removeChildNodes", value);
+
+ m.setAggregatePrivilege("jcr:readAccessControl", value);
+ m.setAggregatePrivilege("jcr:modifyAccessControl", value);
+ } else {
+ var writeGranted = $("input[name='privilege@jcr:write'][value=granted]:radio:checked");
+ var writeDenied = $("input[name='privilege@jcr:write'][value=denied]:radio:checked");
+ if (writeGranted.length > 0 || writeDenied.length > 0) {
+ var value = writeGranted.length > 0 ? "granted" : "denied";
+ m.setAggregatePrivilege("jcr:modifyProperties", value);
+ m.setAggregatePrivilege("jcr:removeNode", value);
+ m.setAggregatePrivilege("jcr:addChildNodes", value);
+ m.setAggregatePrivilege("jcr:removeChildNodes", value);
+ }
+ }
+
+ $("input[name='privilege@jcr:all']:radio").bind("change", function(e) {
+ m.setAggregatePrivilege("jcr:read", this.value);
+ m.setAggregatePrivilege("jcr:write", this.value);
+ m.setAggregatePrivilege("jcr:modifyProperties", this.value);
+ m.setAggregatePrivilege("jcr:removeNode", this.value);
+ m.setAggregatePrivilege("jcr:addChildNodes", this.value);
+ m.setAggregatePrivilege("jcr:removeChildNodes", this.value);
+
+ m.setAggregatePrivilege("jcr:readAccessControl", this.value);
+ m.setAggregatePrivilege("jcr:modifyAccessControl", this.value);
+ });
+
+ $("input[name='privilege@jcr:write']:radio").bind("change", function(e) {
+ m.setAggregatePrivilege("jcr:modifyProperties", this.value);
+ m.setAggregatePrivilege("jcr:removeNode", this.value);
+ m.setAggregatePrivilege("jcr:addChildNodes", this.value);
+ m.setAggregatePrivilege("jcr:removeChildNodes", this.value);
+ });
+
+ //attach an autocomplete handler to the name field
+ $( "#principalId" ).autocomplete({
+ source: AccessManager.contextPath + "/system/userManager.autocomplete.json",
+ minLength: 1,
+ select: function(event, ui) {
+ var item = ui.item;
+ $("#principalId")
+ .val(item.value)
+ .data("item", item);
+ }
+ })
+ .data( "autocomplete" )._renderItem = function( ul, item ) {
+ return $( "<li></li>" )
+ .data( "item.autocomplete", item )
+ .append( "<a>" + (item.label ? (item.label + " (" + item.value + ")") : item.value) + "</a>" )
+ .appendTo( ul );
+ };
+
+ //attach a confirmation dialog to the 'Remove' link
+ $('#removeAceLink').click( function(e) {
+ //initialize the confirmation dialog
+ $("#remove-ace-dialog").dialog({
+ autoOpen: false,
+ height: 'auto',
+ width: 350,
+ modal: true,
+ resizable: false,
+ buttons: [
+ {
+ text: AccessManager.messages["confirm.yes"],
+ click: function() {
+ $("#remove-ace-form").submit();
+ }
+ },
+ {
+ text: AccessManager.messages["confirm.no"],
+ click: function() {
+ $("#remove-ace-dialog").dialog("close");
+ }
+ }
+ ]
+ });
+
+ //show the dialog
+ $('#remove-ace-dialog').dialog('open');
+ return false;
+ });
+ },
+
+ setAggregatePrivilege: function(privilegeName, value) {
+ var btn = $("input[name='privilege@" + privilegeName + "'][value=granted]:radio");
+ btn.attr('checked', value == "granted");
+ btn.attr('disabled', value != "none");
+
+ btn = $("input[name='privilege@" + privilegeName + "'][value=denied]:radio");
+ btn.attr('checked', value == "denied");
+ btn.attr('disabled', value != "none");
+
+ btn = $("input[name='privilege@" + privilegeName + "'][value=none]:radio");
+ btn.attr('checked', value == "none");
+ btn.attr('disabled', value != "none");
+ }
+};
+
+/**
+ * Initialize any objects that are active on the current page
+ */
+$(function() {
+ //make visible any elements that require scripting to be enabled
+ $(".noscript-hide").removeClass("noscript-hide");
+
+ if ($("#sidebar-nav").length > 0) {
+ AccessManager.SideBar.init();
+ }
+
+ if ($("#update-acl-block").length > 0) {
+ AccessManager.Acl.init();
+ }
+
+ if ($("#update-ace-form").length > 0) {
+ AccessManager.Ace.init();
+ }
+});
Propchange: sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.min.js
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.min.js?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.min.js (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.min.js Sun May 1 22:46:46 2011
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+AccessManager={contextPath:"",messages:{"error.dlg.title":"Error","confirm.yes":"Yes","confirm.no":"No","button.add":"Add","tooltip.removeProperty":"Remove Property","tooltip.removeMember":"Remove Member","group.updated.msg":"Updated the group","user.updated.msg":"Updated the user","user.pwd.updated.msg":"Updated the password"}};
+AccessManager.SideBar={init:function(){var c,b,a,d,e;
+b=$("ul#sidebar-nav li a");
+a=location.href;
+d=location.hash;
+if(d!=null&&d.length>0){a=a.substring(0,a.length-d.length)
+}for(c=0;
+c<b.length;
+c++){e=b[c];
+if(a==e.href){$(e.parentNode).addClass("ui-corner-all ui-state-highlight")
+}}}};
+AccessManager.ErrorDlg={showError:function(b,a){if($("#error_dialog").length==0){$("body").append('<div id="error_dialog" style="display:none;"></div>')
+}$("#error_dialog").html(a);
+$("#error_dialog").dialog({title:b,bgiframe:true,autoOpen:false,width:400,maxHeight:500,modal:true});
+$("#error_dialog").dialog("open")
+},errorHandler:function(d,g,c){var f,b;
+try{f=UserMgmt.messages["error.dlg.title"];
+b=$.parseJSON(d.responseText);
+if(b.error){UserMgmt.ErrorDlg.showError(f,b.error.message)
+}else{UserMgmt.ErrorDlg.showError(f,d.responseText)
+}}catch(a){UserMgmt.ErrorDlg.showError(f,d.responseText)
+}}};
+AccessManager.Acl={init:function(){$("#acl-list button").button();
+$("#acl-list tbody tr:odd").addClass("odd");
+$(".remove-ace").click(function(b){var a=this.form;
+$("#remove-ace-dialog").dialog({autoOpen:false,height:"auto",width:350,modal:true,resizable:false,buttons:[{text:AccessManager.messages["confirm.yes"],click:function(){a.submit()
+}},{text:AccessManager.messages["confirm.no"],click:function(){$("#remove-ace-dialog").dialog("close")
+}}]});
+$("#remove-ace-dialog").dialog("open");
+return false
+})
+}};
+AccessManager.Ace={init:function(){var b,d;
+b=AccessManager.Ace;
+$("#ace-list tbody tr:odd").addClass("odd");
+$("#addAceSaveButton").button();
+d=$("#update-ace-form");
+d.validate({rules:{principalId:"required"}});
+var f=$("input[name='privilege@jcr:all'][value=granted]:radio:checked");
+var a=$("input[name='privilege@jcr:all'][value=denied]:radio:checked");
+if(f.length>0||a.length>0){var e=f.length>0?"granted":"denied";
+b.setAggregatePrivilege("jcr:read",e);
+b.setAggregatePrivilege("jcr:write",e);
+b.setAggregatePrivilege("jcr:modifyProperties",e);
+b.setAggregatePrivilege("jcr:removeNode",e);
+b.setAggregatePrivilege("jcr:addChildNodes",e);
+b.setAggregatePrivilege("jcr:removeChildNodes",e);
+b.setAggregatePrivilege("jcr:readAccessControl",e);
+b.setAggregatePrivilege("jcr:modifyAccessControl",e)
+}else{var c=$("input[name='privilege@jcr:write'][value=granted]:radio:checked");
+var g=$("input[name='privilege@jcr:write'][value=denied]:radio:checked");
+if(c.length>0||g.length>0){var e=c.length>0?"granted":"denied";
+b.setAggregatePrivilege("jcr:modifyProperties",e);
+b.setAggregatePrivilege("jcr:removeNode",e);
+b.setAggregatePrivilege("jcr:addChildNodes",e);
+b.setAggregatePrivilege("jcr:removeChildNodes",e)
+}}$("input[name='privilege@jcr:all']:radio").bind("change",function(h){b.setAggregatePrivilege("jcr:read",this.value);
+b.setAggregatePrivilege("jcr:write",this.value);
+b.setAggregatePrivilege("jcr:modifyProperties",this.value);
+b.setAggregatePrivilege("jcr:removeNode",this.value);
+b.setAggregatePrivilege("jcr:addChildNodes",this.value);
+b.setAggregatePrivilege("jcr:removeChildNodes",this.value);
+b.setAggregatePrivilege("jcr:readAccessControl",this.value);
+b.setAggregatePrivilege("jcr:modifyAccessControl",this.value)
+});
+$("input[name='privilege@jcr:write']:radio").bind("change",function(h){b.setAggregatePrivilege("jcr:modifyProperties",this.value);
+b.setAggregatePrivilege("jcr:removeNode",this.value);
+b.setAggregatePrivilege("jcr:addChildNodes",this.value);
+b.setAggregatePrivilege("jcr:removeChildNodes",this.value)
+});
+$("#principalId").autocomplete({source:AccessManager.contextPath+"/system/userManager.autocomplete.json",minLength:1,select:function(i,j){var h=j.item;
+$("#principalId").val(h.value).data("item",h)
+}}).data("autocomplete")._renderItem=function(h,i){return $("<li></li>").data("item.autocomplete",i).append("<a>"+(i.label?(i.label+" ("+i.value+")"):i.value)+"</a>").appendTo(h)
+};
+$("#removeAceLink").click(function(h){$("#remove-ace-dialog").dialog({autoOpen:false,height:"auto",width:350,modal:true,resizable:false,buttons:[{text:AccessManager.messages["confirm.yes"],click:function(){$("#remove-ace-form").submit()
+}},{text:AccessManager.messages["confirm.no"],click:function(){$("#remove-ace-dialog").dialog("close")
+}}]});
+$("#remove-ace-dialog").dialog("open");
+return false
+})
+},setAggregatePrivilege:function(b,c){var a=$("input[name='privilege@"+b+"'][value=granted]:radio");
+a.attr("checked",c=="granted");
+a.attr("disabled",c!="none");
+a=$("input[name='privilege@"+b+"'][value=denied]:radio");
+a.attr("checked",c=="denied");
+a.attr("disabled",c!="none");
+a=$("input[name='privilege@"+b+"'][value=none]:radio");
+a.attr("checked",c=="none");
+a.attr("disabled",c!="none")
+}};
+$(function(){$(".noscript-hide").removeClass("noscript-hide");
+if($("#sidebar-nav").length>0){AccessManager.SideBar.init()
+}if($("#update-acl-block").length>0){AccessManager.Acl.init()
+}if($("#update-ace-form").length>0){AccessManager.Ace.init()
+}});
\ No newline at end of file
Propchange: sling/trunk/samples/accessmanager-ui/src/main/resources/js/accessmanager/accessmanager.min.js
------------------------------------------------------------------------------
svn:eol-style = native
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/page.html.esp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/page.html.esp?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/page.html.esp (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/page.html.esp Sun May 1 22:46:46 2011
@@ -0,0 +1,117 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xml:lang="<%=response.getLocale().getLanguage()%>" lang="<%=response.getLocale().getLanguage()%>"
+ xmlns="http://www.w3.org/1999/xhtml"
+>
+<head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <%
+ //allow the caller to override the title by
+ // specifying request attributes.
+ var title = request.getAttribute("page.title");
+ if (title == null) {
+ title = resource.path;
+ }
+
+ var userDisplayName = null;
+ if (request.getUserPrincipal() != null && !"anonymous".equals(request.getRemoteUser())) {
+ var userResource = request.getResourceResolver().getResource("/system/userManager/user/" + request.getRemoteUser());
+ var valueMap = userResource.adaptTo(Packages.org.apache.sling.api.resource.ValueMap);
+ userDisplayName = valueMap.get("displayName", request.getRemoteUser());
+ }
+
+ var currentPage = request.contextPath + resource.path + ".html";
+ var logoutTarget = request.getAttribute("logout.target");
+ if (logoutTarget == null) {
+ logoutTarget = currentPage;
+ }
+ var rb = request.getResourceBundle("org.apache.sling.accessmanager.Resources", null);
+ %>
+ <title><%= Packages.java.text.MessageFormat.format(rb.getString("page.template.title"), title) %></title>
+
+ <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/themes/cupertino/jquery-ui.css" type="text/css"/>
+ <link rel="stylesheet" href="<%= request.getContextPath() %>/css/accessmanager/accessmanager.min.css" type="text/css"/>
+</head>
+<%
+//flush the buffer early so the browser can start start fetching the stylesheets and scripts in parallel
+// while the rest of the page is being rendered below.
+response.flushBuffer();
+%>
+<body>
+ <div id="menu_login" class="ui-widget ui-widget-content ui-corner-all">
+ <% if (userDisplayName != null) { %>
+ <strong id="menu_username"><%=userDisplayName%></strong> | <a href="<%=request.contextPath%>/system/sling/logout?resource=<%=logoutTarget%>" id="do_logout"><%=rb.getString("link.logout")%></a>
+ <% } else { %>
+ <a href="<%=request.contextPath%>/system/sling/selector/login?resource=<%=currentPage%>" id="do_login"><%=rb.getString("link.login")%></a>
+ <% } %>
+ </div>
+
+ <div class="title">
+ <div class="logo">
+ <a href="http://sling.apache.org">
+ <img alt='<%=rb.getString("logo.alt")%>' src="<%=request.getContextPath()%>/images/sling-logo.png"/>
+ </a>
+ </div>
+ </div>
+
+ <div class="menu">
+ <%
+ var template = request.getAttribute("sidebar.template");
+ if (template != null) {
+ var options = request.getAttribute("sidebar.template.options");
+ if (options == null) {
+ sling.include(template);
+ } else {
+ sling.include(template, options);
+ }
+ }
+ %>
+ </div>
+
+ <div id="content" class="main">
+ <noscript>
+ <div class="ui-widget" style="margin-bottom: 10px;">
+ <div style="padding: 0pt 0.7em;" class="ui-state-error ui-corner-all">
+ <p><span style="float: left; margin-right: 0.3em;" class="ui-icon ui-icon-alert"></span>
+ <%=rb.getString("msg.noscript")%></p>
+ </div>
+ </div>
+ </noscript>
+
+ <%
+ var template = request.getAttribute("body.template");
+ if (template != null) {
+ var options = request.getAttribute("body.template.options");
+ if (options == null) {
+ sling.include(template);
+ } else {
+ sling.include(template, options);
+ }
+ }
+ %>
+ </div>
+
+ <%-- scripts moved to the bottom to help the page load faster --%>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.5.2/jquery.min.js"></script>
+ <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.12/jquery-ui.min.js"></script>
+ <script type="text/javascript" src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.8/jquery.validate.min.js"></script>
+ <script type="text/javascript" src="<%= request.getContextPath() %>/js/accessmanager/accessmanager.min.js"></script>
+ <script type="text/javascript">AccessManager.contextPath = "<%=request.contextPath%>";</script>
+</body>
+</html>
\ No newline at end of file
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/sidebar.html.esp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/sidebar.html.esp?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/sidebar.html.esp (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/accessmanager/sidebar.html.esp Sun May 1 22:46:46 2011
@@ -0,0 +1,50 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var privilegesInfo = new Packages.org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo();
+var rb = request.getResourceBundle("org.apache.sling.accessmanager.Resources", null);
+var canModify = privilegesInfo.canModifyAccessControl(currentNode);
+%>
+<ul id="sidebar-nav" class="ui-corner-br">
+ <li>
+ <a href="<%=request.contextPath%><%=resource.path%>.acl.html"><%=rb.getString(canModify ? "menu.link.update.acl" : "menu.link.view.acl")%></a>
+ </li>
+ <% if (canModify) { %>
+ <li>
+ <a style="margin-left: 15px;" href="<%=request.contextPath%><%=resource.path%>.ace.html"><%=rb.getString("menu.link.add.ace")%></a>
+ </li>
+ <% } %>
+ <%
+ var reqUri = request.getAttribute("javax.servlet.include.request_uri");
+ var isAcePage = reqUri.endsWith(".ace.html");
+ if (isAcePage) {
+ if (canModify) {
+ var pid = request.getParameter("pid");
+ if (pid != null && pid.length() > 0) {
+ %>
+ <li class="ui-corner-all ui-state-highlight">
+ <a style="margin-left: 15px;" href="<%=request.contextPath%><%=resource.path%>.ace.html?pid=<%=pid%>"><%=rb.getString("menu.link.update.ace")%></a>
+ </li>
+ <% }
+ } else { %>
+ <li class="ui-corner-all ui-state-highlight">
+ <a style="margin-left: 15px;" href="<%=request.contextPath%><%=resource.path%>.ace.html?pid=<%=pid%>"><%=rb.getString("menu.link.view.ace")%></a>
+ </li>
+ <% }
+ } /*endif(isAcePage) */%>
+</ul>
\ No newline at end of file
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace.html.esp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace.html.esp?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace.html.esp (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace.html.esp Sun May 1 22:46:46 2011
@@ -0,0 +1,48 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ var privilegesInfo = new Packages.org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo();
+ if (!privilegesInfo.canReadAccessControl(currentNode)) {
+ //user can't modify the ACE.
+ response.sendError(403);
+ } else {
+ if (!response.isCommitted()) {
+ //don't allow caching of this page
+ response.setDateHeader("Expires", 0);
+ response.setHeader("Pragma", "no-cache");
+ response.setHeader("Cache-control", "no-cache, must-revalidate");
+ }
+
+ var rb = request.getResourceBundle("org.apache.sling.accessmanager.Resources", null);
+ var canModify = privilegesInfo.canModifyAccessControl(currentNode);
+
+ //header options
+ request.setAttribute("page.title", rb.getString(canModify ? "menu.link.update.ace" : "menu.link.view.ace"));
+
+ //page sidebar template
+ request.setAttribute("sidebar.template", resource.path + ".sidebar.html");
+ request.setAttribute("sidebar.template.options", "sling/accessmanager");
+
+ //page body template
+ request.setAttribute("body.template", resource.path + ".ace_body.html");
+ // request.setAttribute("body.template.options", "sling/accessManager");
+
+ //render the page using the default page template
+ sling.include(resource.path + ".page.html", "sling/accessmanager");
+ }
+%>
\ No newline at end of file
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace_body.html.esp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace_body.html.esp?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace_body.html.esp (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/ace_body.html.esp Sun May 1 22:46:46 2011
@@ -0,0 +1,193 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+var privilegesInfo = new Packages.org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo();
+if (!privilegesInfo.canReadAccessControl(currentNode)) {
+ //user can't read the ACL.
+ response.sendError(403);
+} else {
+ if (!response.isCommitted()) {
+ //don't allow caching of this page
+ response.setDateHeader("Expires", 0);
+ response.setHeader("Pragma", "no-cache");
+ response.setHeader("Cache-control", "no-cache, must-revalidate");
+ }
+
+
+ var rb = request.getResourceBundle("org.apache.sling.accessmanager.Resources", null);
+
+ function format(key, args) {
+ var value = rb.getString(key);
+ return Packages.java.text.MessageFormat.format(value, args);
+ }
+
+ /**
+ * @param p the privilege for the row
+ */
+ function drawPrivilegeRow(p, paddingLeft) {
+ if (p == null) {
+ return;
+ }
+ var isIgnored, isGranted, isDenied = false;
+ isIgnored = !(granted.contains(p) || denied.contains(p));
+ isGranted = granted.contains(p);
+ isDenied = denied.contains(p);
+ var displayText = rb.getString("label.privilege." + p.getName());
+%>
+ <tr>
+ <td style="padding-left: <%=paddingLeft%>"><span id="privilege_<%=p.getName()%>_label"><%=displayText != null ? displayText : p.getName()%></span></td>
+ <td align="center"><input type="radio" name="privilege@<%=p.getName()%>" value="none" <%=isIgnored ? 'checked="checked"' : ''%> <%=canModify ? '' : 'disabled="disabled"'%>/></td>
+ <td align="center"><input type="radio" name="privilege@<%=p.getName()%>" value="granted" <%=isGranted ? 'checked="checked"' : ''%> <%=canModify ? '' : 'disabled="disabled"'%>/></td>
+ <td align="center"><input type="radio" name="privilege@<%=p.getName()%>" value="denied" <%=isDenied ? 'checked="checked"' : ''%> <%=canModify ? '' : 'disabled="disabled"'%>/></td>
+ </tr>
+<%
+ } /* end drawPrivilege function */
+
+ var granted, denied;
+ var principalId = request.getParameter("pid"); //formContext.getFieldValue("principalId"); //get from validation context if available
+ if (principalId == null) {
+ principalId = new String("");
+ }
+
+ var privilegesInfo = new Packages.org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo();
+ if (principalId.equals("")) {
+ //this is a new ACE, so no principal is entered yet.
+ granted = Packages.java.util.Collections.emptySet();
+ denied = Packages.java.util.Collections.emptySet();
+ } else {
+ //updating an existing ACE, so load the current privileges
+ var accessRights = privilegesInfo.getDeclaredAccessRightsForPrincipal(currentNode, principalId);
+ granted = accessRights.getGranted();
+ denied = accessRights.getDenied();
+ }
+ var canModify = privilegesInfo.canModifyAccessControl(currentNode);
+ var canRemove = canModify && !principalId.equals("");
+%>
+
+<div class="ui-widget ui-widget-content ui-corner-all accessmgmt-body" id="update-ace-block" >
+ <h3 class="ui-widget-header ui-corner-all accessmgmt-header"><%=format(canModify ? "header.update.acl" : "header.view.acl", [currentNode.name])%></h3>
+
+ <form id="update-ace-form" method="post" action="<%=request.contextPath%><%=currentNode.path%>.modifyAce.html" >
+ <div>
+ <input type="hidden" name=":redirect" value="<%=request.contextPath%><%=currentNode.path%>.acl.html" />
+
+ <div class="prop-line ui-helper-clearfix">
+ <label for="principalId"><%=rb.getString("label.ace.principalId")%></label>
+ <input id="principalId" type="text" name="principalId" value='<%=principalId%>' <%=principalId.equals("") ? "" : "readonly='readonly'" %>/>
+ </div>
+
+ <% if (canModify) { %>
+ <div class="prop-line ui-helper-clearfix">
+ <label for="order"><%=rb.getString("label.ace.order")%></label>
+ <select id="order" name="order">
+ <option value=""><%=rb.getString("ace.order.option.default")%></option>
+ <option value="first"><%=rb.getString("ace.order.option.first")%></option>
+ <%
+ var accessMap = privilegesInfo.getDeclaredAccessRights(currentNode);
+ var entrySet = accessMap.entrySet();
+ var iterator = entrySet.iterator();
+ if (iterator.hasNext()) iterator.next(); //skip the first one since it is covered by the 'first' option.
+ while (iterator.hasNext()) {
+ var entry = iterator.next();
+ var principal = entry.getKey();
+ if (principal.getName().equals(principalId)) {
+ continue; //skip it
+ }
+ %>
+ <option value="before <%=principal.getName()%>"><%=format("ace.order.option.before", [principal.getName()])%></option>
+ <% } %>
+ <option value="last"><%=rb.getString("ace.order.option.last")%></option>
+ </select>
+ </div>
+ <% } /*endif (canModify) */ %>
+
+ <div class="prop-line ui-helper-clearfix">
+ <label><%=rb.getString("label.ace.privileges")%></label>
+
+ <table id="ace-list" width="100%" class="ui-widget ui-widget-content">
+ <thead class="ui-widget-header">
+ <tr>
+ <th align="left"> </th>
+ <th align="center"><%=rb.getString("column.privilege.notset")%></th>
+ <th align="center"><%=rb.getString("column.privilege.granted")%></th>
+ <th align="center"><%=rb.getString("column.privilege.denied")%></th>
+ </tr>
+ </thead>
+ <tbody>
+ <%
+ var accessControlManager = Packages.org.apache.sling.jcr.base.util.AccessControlUtil.getAccessControlManager(currentNode.session);
+ var p = accessControlManager.privilegeFromName("jcr:all");
+ drawPrivilegeRow(p, "10px");
+
+ p = accessControlManager.privilegeFromName("jcr:read");
+ drawPrivilegeRow(p, "30px");
+
+ p = accessControlManager.privilegeFromName("jcr:write");
+ drawPrivilegeRow(p, "30px");
+
+ p = accessControlManager.privilegeFromName("jcr:modifyProperties");
+ drawPrivilegeRow(p, "50px");
+
+ p = accessControlManager.privilegeFromName("jcr:removeNode");
+ drawPrivilegeRow(p, "50px");
+
+ p = accessControlManager.privilegeFromName("jcr:addChildNodes");
+ drawPrivilegeRow(p, "50px");
+
+ p = accessControlManager.privilegeFromName("jcr:removeChildNodes");
+ drawPrivilegeRow(p, "50px");
+
+ p = accessControlManager.privilegeFromName("jcr:readAccessControl");
+ drawPrivilegeRow(p, "30px");
+
+ p = accessControlManager.privilegeFromName("jcr:modifyAccessControl");
+ drawPrivilegeRow(p, "30px");
+ %>
+ </tbody>
+ </table>
+ </div>
+
+ <% if (canModify) { %>
+ <div id="updateSubmitBtns" class="prop-line ui-helper-clearfix">
+ <label> </label>
+ <button accesskey="a" id="addAceSaveButton" type="submit"><%=rb.getString("button.save")%></button>
+ <% if (canRemove) { %>
+ <span class="noscript-hide">
+ <a href="#" id="removeAceLink"><%=rb.getString("link.remove")%></a>
+ </span>
+ <% } %>
+ </div>
+ <% } /* endif(canModify) */ %>
+ </div>
+ </form>
+</div>
+
+<% if (canRemove) { %>
+<div id="remove-ace-dialog" title='<%=rb.getString("dialog.title.confirm.remove")%>' style="display:none">
+ <form id='remove-ace-form' action="<%=resource.path%>.deleteAce.html" method="post">
+ <fieldset>
+ <input type="hidden" name=":redirect" value="<%=request.contextPath%><%=currentNode.path%>.acl.html" />
+ <input type="hidden" name=":applyTo" value="<%=principalId%>" />
+ <p>
+ <%=rb.getString("msg.ace.confirm.remove") %>
+ </p>
+ </fieldset>
+ </form>
+</div>
+<% } /*endif(canRemove) */ %>
+<% } /* end else (access check) */ %>
Added: sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/acl.html.esp
URL: http://svn.apache.org/viewvc/sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/acl.html.esp?rev=1098430&view=auto
==============================================================================
--- sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/acl.html.esp (added)
+++ sling/trunk/samples/accessmanager-ui/src/main/resources/libs/sling/servlet/default/acl.html.esp Sun May 1 22:46:46 2011
@@ -0,0 +1,47 @@
+<%
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+ var privilegesInfo = new Packages.org.apache.sling.jcr.jackrabbit.accessmanager.PrivilegesInfo();
+ if (!privilegesInfo.canReadAccessControl(currentNode)) {
+ //user can't read the ACL.
+ response.sendError(403);
+ } else {
+ if (!response.isCommitted()) {
+ //don't allow caching of this page
+ response.setDateHeader("Expires", 0);
+ response.setHeader("Pragma", "no-cache");
+ response.setHeader("Cache-control", "no-cache, must-revalidate");
+ }
+
+ var rb = request.getResourceBundle("org.apache.sling.accessmanager.Resources", null);
+
+ //header options
+ request.setAttribute("page.title", rb.getString("page.title.acl"));
+
+ //page sidebar template
+ request.setAttribute("sidebar.template", resource.path + ".sidebar.html");
+ request.setAttribute("sidebar.template.options", "sling/accessmanager");
+
+ //page body template
+ request.setAttribute("body.template", resource.path + ".acl_body.html");
+ // request.setAttribute("body.template.options", "sling/accessManager");
+
+ //render the page using the default page template
+ sling.include(resource.path + ".page.html", "sling/accessmanager");
+ }
+%>
\ No newline at end of file