Author: cmailleux
Date: Thu Jul 12 17:25:42 2007
New Revision: 17971
URL: https://svndev.jahia.net/websvn/listing.php?sc=3D1&rev=3D17971&repname=
=3Djahia
Log:
Port of commit [17247] Call the good permission in getCategoryChildren
Modified:
trunk/core/src/java/org/jahia/admin/permissions/ManageServerPermissions=
.java
trunk/core/src/java/org/jahia/ajax/categories/GetCategoryChildren.java
trunk/core/src/java/org/jahia/hibernate/manager/JahiaAclNameManager.java
trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java
Modified: trunk/core/src/java/org/jahia/admin/permissions/ManageServerPermi=
ssions.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/admin/permissions/ManageServerPermissions.java&rev=3D17971&repname=
=3Djahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/admin/permissions/ManageServerPermissions=
.java (original)
+++ trunk/core/src/java/org/jahia/admin/permissions/ManageServerPermissions=
.java Thu Jul 12 17:25:42 2007
@@ -48,7 +48,7 @@
=
/**
* User: Serge Huber
- * Date: 27 d=C3=A9c. 2005
+ * Date: 27 d=C3=AF=C2=BF=C2=BDc. 2005
* Time: 14:16:23
* Copyright (C) Jahia Inc.
*/
@@ -200,7 +200,7 @@
// this not only updates the cache but also persists modificat=
ions in database
ServicesRegistry.getInstance().getJahiaACLManagerService().upd=
ateCache(acl);
}
-
+ ServicesRegistry.getInstance().getJahiaACLManagerService().flushCa=
che();
displayPermissions (request, response, session);
}
=
Modified: trunk/core/src/java/org/jahia/ajax/categories/GetCategoryChildren=
.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/ajax/categories/GetCategoryChildren.java&rev=3D17971&repname=3Djah=
ia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/ajax/categories/GetCategoryChildren.java =
(original)
+++ trunk/core/src/java/org/jahia/ajax/categories/GetCategoryChildren.java =
Thu Jul 12 17:25:42 2007
@@ -77,7 +77,7 @@
final boolean isPortletCategoriesContext =3D portletCategories=
!=3D null && portletCategories.equalsIgnoreCase(ManageApplicationCategorie=
sEngine.PORLET_CATEGORIES_TRUE);
final boolean isAdmincontext =3D admin.length() > 0;
if (isAdmincontext) {
- if (aclService.getServerActionPermission("org.jahia.action=
s.server.admin.categories.ManageCategories",
+ if (aclService.getServerActionPermission("admin.categories=
.ManageCategories",
currentUser, JahiaBaseACL.READ_RIGHTS, jParams.get=
SiteID()) < 1) {
logger.warn("Error: Must be logged in and have 'Manage=
Categories' access");
response.sendError(HttpServletResponse.SC_FORBIDDEN,
Modified: trunk/core/src/java/org/jahia/hibernate/manager/JahiaAclNameManag=
er.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/hibernate/manager/JahiaAclNameManager.java&rev=3D17971&repname=3Dj=
ahia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/hibernate/manager/JahiaAclNameManager.jav=
a (original)
+++ trunk/core/src/java/org/jahia/hibernate/manager/JahiaAclNameManager.jav=
a Thu Jul 12 17:25:42 2007
@@ -14,7 +14,8 @@
* 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.
- */package org.jahia.hibernate.manager;
+ */
+package org.jahia.hibernate.manager;
=
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -29,6 +30,7 @@
import org.jahia.services.acl.ACLInfo;
import org.jahia.services.acl.JahiaBaseACL;
import org.jahia.services.cache.Cache;
+import org.jahia.services.cache.CacheService;
import org.jahia.utils.JahiaTools;
import org.springframework.orm.ObjectRetrievalFailureException;
=
@@ -38,10 +40,7 @@
import java.util.Map;
=
/**
- * User: Serge Huber
- * Date: 14 d=C3=A9c. 2005
- * Time: 14:52:14
- * Copyright (C) Jahia Inc.
+ * User: Serge Huber Date: 14 d=C3=83=C2=A9c. 2005 Time: 14:52:14 Copyrigh=
t (C) Jahia Inc.
*/
public class JahiaAclNameManager {
public static final String JAHIA_ACL_NAMES =3D "AclNames";
@@ -56,14 +55,12 @@
private Cache cache;
=
private void checkCache() {
- if(cache =3D=3D null)
- cache =3D ServicesRegistry.getInstance().getCacheService().getCach=
e(JAHIA_ACL_NAMES);
- if(cache=3D=3Dnull)
- try {
- cache =3D ServicesRegistry.getInstance().getCacheService()=
.createCacheInstance(JAHIA_ACL_NAMES);
- } catch (JahiaInitializationException e) {
- e.printStackTrace(); //To change body of catch statement =
use File | Settings | File Templates.
- }
+ if (cache =3D=3D null) cache =3D ServicesRegistry.getInstance().ge=
tCacheService().getCache(JAHIA_ACL_NAMES);
+ if (cache =3D=3D null) try {
+ cache =3D ServicesRegistry.getInstance().getCacheService().cre=
ateCacheInstance(JAHIA_ACL_NAMES);
+ } catch (JahiaInitializationException e) {
+ log.error(e);
+ }
}
=
public void setAclDao(JahiaAclDAO aclDao) {
@@ -79,28 +76,22 @@
}
=
/**
- * This is a powerful method, that not only tries to lookup an acl nam=
e, but
- * also creates it if default entries exist. Default entries are also =
looked up
- * recursively to parent definition, using a "." seperator. Basically =
if
- * we lookup the acl name :
- * org.jahia.admin.ManageUsers.addUser.sitekey_defaultSite
- * the lookup will be done in the following way :
- * org.jahia.admin.ManageUsers.addUser.sitekey_defaultSite
- * org.jahia.admin.ManageUsers.addUser
- * org.jahia.admin.ManageUsers
- * org.jahia.admin
- * org.jahia
- * org
+ * This is a powerful method, that not only tries to lookup an acl nam=
e, but also creates it if default entries
+ * exist. Default entries are also looked up recursively to parent def=
inition, using a "." seperator. Basically if
+ * we lookup the acl name : org.jahia.admin.ManageUsers.addUser.siteke=
y_defaultSite the lookup will be done in the
+ * following way : org.jahia.admin.ManageUsers.addUser.sitekey_default=
Site org.jahia.admin.ManageUsers.addUser
+ * org.jahia.admin.ManageUsers org.jahia.admin org.jahia org
+ *
* @param aclName the ACL name to lookup, or to create if it doesn't e=
xist yet
- * @param siteID if >0, will be used to replace * markers used in
- * principal names in the default ACL entries to specify the site on w=
hich
- * the users/groups will be used.
+ * @param siteID if >0, will be used to replace * markers used in pri=
ncipal names in the default ACL entries to
+ * specify the site on which the users/groups will be u=
sed.
+ *
* @return the ACL name object that was found or created.
*/
public synchronized JahiaAclName findOrCreateJahiaAclNameByName(String=
aclName, int siteID) {
- if(aclName!=3Dnull) {
+ if (aclName !=3D null) {
try {
- if( !"".equals(aclName)) {
+ if (!"".equals(aclName)) {
checkCache();
=
JahiaAclName aclNameResult =3D (JahiaAclName) cache.ge=
t(aclName);
@@ -134,13 +125,14 @@
// the parent's name and look in there.
int lastDotPos =3D curAclName.lastIndexOf(".");
if (lastDotPos > -1) {
- curAclName =3D curAclName.substring(0, la=
stDotPos);
- continue;
- } else {
+ curAclName =3D curAclName.substring(0, las=
tDotPos);
+ }
+ else {
// no more dot separators, we stop searchi=
ng here
break;
}
- } else {
+ }
+ else {
// we have found a default entry set definitio=
n, let's
// stop the searching here.
found =3D true;
@@ -178,19 +170,20 @@
if (key.startsWith("g:")) {
userType =3D new Integer(ACLInfo.GROUP_TYPE_EN=
TRY);
principalName =3D key.substring("g:".length());
- } else if (key.startsWith("u:")) {
+ }
+ else if (key.startsWith("u:")) {
userType =3D new Integer(ACLInfo.USER_TYPE_ENT=
RY);
principalName =3D key.substring("u:".length());
- } else {
- log.warn("Invalid principal name found : "+key=
+", ignoring default entry");
+ }
+ else {
+ log.warn("Invalid principal name found : " + k=
ey + ", ignoring default entry");
continue;
}
if (siteID > 0) {
principalName =3D principalName.replaceAll("\\=
*", Integer.toString(siteID));
}
- JahiaAclEntry aclEntry =3D new JahiaAclEntry(
- new JahiaAclEntryPK(acl, userType, princip=
alName),
- 0, 0);
+ JahiaAclEntry aclEntry =3D
+ new JahiaAclEntry(new JahiaAclEntryPK(acl,=
userType, principalName), 0, 0);
String permissionStr =3D ((String) curEntry.getVal=
ue()).toLowerCase();
if (permissionStr.indexOf("r") !=3D -1) {
aclEntry.setPermission(JahiaBaseACL.READ_RIGHT=
S, JahiaAclEntry.ACL_YES);
@@ -203,7 +196,8 @@
}
if (userType.intValue() =3D=3D ACLInfo.GROUP_TYPE_=
ENTRY) {
groupAclEntries.put(principalName, aclEntry);
- } else {
+ }
+ else {
userAclEntries.put(principalName, aclEntry);
}
}
@@ -221,16 +215,16 @@
return jahiaAclName;
}
} catch (NumberFormatException e) {
- log.warn("Try to find an acl with passing an empty string =
"+aclName,e);
+ log.warn("Try to find an acl with passing an empty string =
" + aclName, e);
}
}
- throw new ObjectRetrievalFailureException(JahiaAcl.class,aclName);
+ throw new ObjectRetrievalFailureException(JahiaAcl.class, aclName);
}
=
public JahiaAclName findJahiaAclNameByName(String aclName) {
- if(aclName!=3Dnull) {
+ if (aclName !=3D null) {
try {
- if( !"".equals(aclName)) {
+ if (!"".equals(aclName)) {
checkCache();
=
JahiaAclName aclNameResult =3D (JahiaAclName) cache.ge=
t(aclName);
@@ -245,23 +239,23 @@
}
}
} catch (NumberFormatException e) {
- log.warn("Try to find an acl with passing an empty string =
"+aclName,e);
+ log.warn("Try to find an acl with passing an empty string =
" + aclName, e);
}
}
- throw new ObjectRetrievalFailureException(JahiaAcl.class,aclName);
+ throw new ObjectRetrievalFailureException(JahiaAcl.class, aclName);
}
=
public List findJahiaAclNamesStartingWith(String aclName) {
- if(aclName!=3Dnull) {
+ if (aclName !=3D null) {
try {
- if( !"".equals(aclName)) {
+ if (!"".equals(aclName)) {
return aclNamesDao.findAclNamesStartingWith(aclName);
}
} catch (NumberFormatException e) {
- log.warn("Try to find an acl with passing an empty string =
"+aclName,e);
+ log.warn("Try to find an acl with passing an empty string =
" + aclName, e);
}
}
- throw new ObjectRetrievalFailureException(JahiaAcl.class,aclName);
+ throw new ObjectRetrievalFailureException(JahiaAcl.class, aclName);
}
=
public void saveAclName(JahiaAclName jahiaAclName) {
@@ -282,4 +276,17 @@
cache.remove(jahiaAclName.getAclName());
}
=
+ /**
+ * Copy of the method from JahiaAclManager
+ */
+ public void flushCache() {
+ ServicesRegistry instance =3D ServicesRegistry.getInstance();
+ if (instance !=3D null) {
+ CacheService cacheService =3D instance.getCacheService();
+ if (cacheService !=3D null) {
+ cache =3D cacheService.getCache(JahiaAclNameManager.JAHIA_=
ACL_NAMES);
+ if (cache !=3D null) cache.flush(true);
+ }
+ }
+ }
}
Modified: trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService=
.java
URL: https://svndev.jahia.net/websvn/diff.php?path=3D/trunk/core/src/java/o=
rg/jahia/services/acl/JahiaACLManagerService.java&rev=3D17971&repname=3Djah=
ia
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java =
(original)
+++ trunk/core/src/java/org/jahia/services/acl/JahiaACLManagerService.java =
Thu Jul 12 17:25:42 2007
@@ -659,6 +659,7 @@
=
public void flushCache() {
manager.flushCache();
+ nameManager.flushCache();
}
=
/**
_______________________________________________
cvs_list mailing list
[email protected]
http://lists.jahia.org/cgi-bin/mailman/listinfo/cvs_list