mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged V3.3 to HEAD
20440: RM: CapabilitiesTest.testDestroyRecordsCapability (MS SQL Server build) - use non-public nodeService 20441: Include virtual tomcat in installers 20442: Change bitrock builder version to use. 20443: Merged BRANCHES/DEV/V3.3-BUG-FIX to BRANCHES/V3.3: (Fixed tabs and removed 'svn:executable' and 'svn:eol-style') 20384: Merged BRANCHES/DEV/BELARUS/HEAD-2010_04_28 to BRANCHES/DEV/V3.3-BUG-FIX: 20271: ALF-803: Asset Service Improvements 20386: Merged V2.2 to V3.3-BUG-FIX 20385: Merged DEV/BELARUS/V2.2-2010_04_06 to V2.2 20379: V2.2-ALF-1888 AssociationQuery was corrected to filter ... 20387: Version Migrator (ALF-1000) - approx x3 boost (policies ignore version2 store) 20388: Merged BRANCHES/DEV/BELARUS/HEAD-2010_04_28 to BRANCHES/DEV/V3.3-BUG-FIX: 20372: ALF-897: It is impossible to create content when default value selected in ContentHeadlineBackground field for intranet_rssi_landing_template web-form (also fixes ALF-2798 & ALF-791) 20389: Merged BRANCHES/DEV/BELARUS/HEAD-2010_04_28 to BRANCHES/DEV/V3.3-BUG-FIX: 20374: ALF-2723: WCM - Http 500 creating content via webform 20394: Fix for ALF-2257 - It's impossible to find and add group at Records Manage Permissions page 20396: Fixed ALF-2956 "XSS attack is made when a rule is being deleted" 20397: Fix for ALF-922: Mysql does not support unique keys that contain nulls as one would expect 20402: ALF-2186 : Rules not being fired on datalist items - because it's a zero byte file? 20404: Fixed ALF-2109 "Rule doesn't apply to the files in sub-folders when 'Run rule for this folder and its subfolders' action was performed" 20406: Fix for ALF-2985 - Share document library throws error if document modifier or creator is deleted from Alfresco 20409: Improved FormServiceImplTest, added more content related tests and some edge case tests using the FDK model (this test needs to be manually enabled though as the FDK model is not available by default) 20414: Merged DEV/BELARUS/HEAD-2010_04_28 to DEV/V3.3-BUG-FIX 20401: ALF-2616: Serious Web Form layout performance issues on IE8. This fix contains: 20427: Merged DEV/BELARUS/HEAD-2010_04_28 to DEV/V3.3-BUG-FIX 20042: ALF-1523: Failed Kerberos SSO auth doesn't fail through, simply returns a blank page 20323: ALF-1523: Failed Kerberos SSO auth doesn't fail through, simply returns a blank page 20428: Merged DEV/BELARUS/HEAD-2010_04_28 to DEV/V3.3-BUG-FIX 20417: ALF-736: WebDAV Folder Renaming fails on Mac but works on Windows. 20430: Fix for ALF-2313 - Accessing a Doclib folder in Share which has a link to a deleted node fails 20431: Version Migrator (ALF-1000) - migrate 1st batch independently 20432: Fix for ALF-2327 - Can not have more than one Transfer Step in a disposal schedule 20438: ALF-479: Merged DEV/BELARUS/V3.2-2010_01_11 to DEV/V3.3-BUG-FIX 18448: ETHREEOH-4044: External Authentication Subsystem does not perform user mapping for WebDAV requests 20444: Fix for ConcurrentModificationException in file server quota manager. ALF-2970. 20445: Merged HEAD to BRANCHES/V3.3: (RECORD ONLY) 20413: Added clean of quickr project 20446: Changed version to 3.3.1dev 20447: Merged V3.3-BUG-FIX to V3.3 20294: Fixes: ALF-1020 & ALF-1013 for all views except agenda. 20451: Merged V2.2 to V3.3 20450: Merged DEV/BELARUS/V2.2-2010_04_06 to V2.2 20412: ALF-1887: too easy to break alfresco - one can remove the guest user and recreate it but then access to RSS is broken - PersonServiceImpl.beforeDeleteNode prohibits attempts to delete a guest user. 20452: Fix for transaction error from NFS server file expiry thread. ALF-3016. 20458: ALF-2729 - rationalise (and deprecate) VersionLabelComparator 20460: Fix for ALF-2430 - AVM nodes are not checked for exclusion - the default ACLEntryVoter will always vote for AVM - avoids embedded AVM permission checks for getType/getAspect and anything else that may be added - seems AVM read is not checked upon "lookup" for the last node in the PATH (getType should have failed too) 20466: Merged V2.2 to V3.3 20243: (RECORD ONLY) ALF-2814: Merged V3.2 to V2.2 17891: Merged DEV_TEMPORARY to V3.2 17873: ETHREEOH-3810: WCM - Recursion detector erroring 20467: Merged V3.1 to V3.3 (RECORD ONLY) 20276: Incremented version label 20275: ALF-2845: Merged V3.2 to V3.1 17768: Merged DEV/BELARUS/V3.2-2009_11_24 to V3.2 17758: ETHREEOH-3757: Oracle upgrade issue: failed "inviteEmailTemplate" patch - also causes subsequent patches to not be applied 19573: Merged V3.2 to V3.1 19539: Merged HEAD to V3.2 19538: Build fix - fix build speed 20468: Merged PATCHES/V3.2.r to V3.3 (RECORD ONLY) 20357: Merged PATCHES/V3.2.0 to PATCHES/V3.2.r 20349: Merged V3.3 to PATCHES/V3.2.0 20346: ALF-2839: Node pre-loading generates needless resultset rows - Added missing Criteria.list() call 20339: Incremented version label 20338: Merged PATCHES/V3.2.0 to PATCHES/V3.2.r 20280: Fixed ALF-2839: Node pre-loading generates needless resultset rows - Split Criteria query to retrieve properties and aspects separately 20272: Backports to help fix ALF-2839: Node pre-loading generates needless resultset rows Merged BRANCHES/V3.2 to PATCHES/V3.2.0: 18490: Added cache for alf_content_data Merged BRANCHES/DEV/V3.3-BUG-FIX to PATCHES/V3.2.0: 20231: Fixed ALF-2784: Degradation of performance between 3.1.1 and 3.2x (observed in JSF) 20266: Test reproduction of ALF-2839 failure: Node pre-loading generates needless resultset rows 20469: Merged PATCHES/V3.1.2 to V3.3 (RECORD ONLY) 20393: Eclipse classpath fix to avoid problems in JBoss 20309: ALF-2777: PrimaryChildAssocCopyBehaviour from MOB-388 corrupts cm:name attributes of copied child nodes - Folded example behaviours from previous AMP into repository - Fixed PrimaryChildAssocCopyBehaviour to back-up and set the cm:name property on copied children 20470: Merged PATCHES/V3.2.0 to V3.3 (RECORD ONLY) 20465: Incremented version label 20464: ALF-3060: Merged V3.2 to PATCHES/V3.2.0 19920: Merged HEAD to BRANCHES/V3.2: 19918: Fix ALF-2499 (Deleting a web project also deletes similarly named web projects - Potential Data Loss) 20448: Merged DEV/V3.3-BUG-FIX to PATCHES/V3.2.0 20414: Merged DEV/BELARUS/HEAD-2010_04_28 to DEV/V3.3-BUG-FIX 20401: ALF-2616: Serious Web Form layout performance issues on IE8. This fix contains: a) X-UA-Compatible head tag with IE=EmulateIE7 value b) alfresco.ieVersion and alfresco.ieEngine in common.js c) recurseOnChildren in _updateDisplay d) Some performance modifications in xforms.js 20350: Increment version label 20349: Merged V3.3 to PATCHES/V3.2.0 20346: ALF-2839: Node pre-loading generates needless resultset rows - Added missing Criteria.list() call 20471: Fix for offline sync losing metadata properties, due to rename/delete of original file. ALF-575. 20478: Merged HEAD to BRANCHES/V3.3: (RECORD ONLY) 20477: Fix ALF-3086: CMIS checkin of a non-versionable document should make it versionable 20479: ALF-2110: Make it possible to determine which person properties are synced via LDAP and hence immutable - Added Set<QName> UserRegistrySynchronizer.getPersonMappedProperties(String username) - UI/Services Fix to follow 20481: Latest SpringSurf libs: - Fix for ALF-1518 - Added support for HTTP and HTTPS proxies for Surf application remote api calls - via the standard JVM cmd line properties such as -Dhttp.proxyHost=... 20484: ALF-2886: LDAP sync defaults display names incorrectly and can't cope with DNs containing escaped trailing whitespace. - Had to work around a JDK bug in LDAP RDN parsing 20486: Added case sensitive flag to the file state cache. Part of ALF-570. 20487: Fix for copy/rename of folders causing file exists errors in some cases. ALF-570. 20488: Fix ALF-680: Previously valid content models now fail with CMISAbstractDictionaryService$DictionaryRegistry exception 20489: Uploaded correct version of spring source jars and reunited them with 3rd-party/.classpath 20490: Fix for cannot delete folders via CIFS from Mac OSX, due to desktop actions. ALF-2553. 20491: Merged DEV/TEMPORARY to V3.3 (With corrections) 20485: ALF-2290: a HTTP GET request of a document redirects to the Home Location when using NTLM SSO The logic related to ADB-61 in NTLMAuthenticationFilter clears previous location and redirects request to default home location. NTLMAuthenticationFilter was changed to process GET requests to documents correctly. Now, fix to ADB-61 processes only “/faces” requests and GET requests to documents are processed correctly. The same fix was made to KerberosAuthenticationFilter 20492: Fix ALF-680: Previously valid content models now fail with CMISAbstractDictionaryService$DictionaryRegistry exception - missing remove directory 20493: Fix ALF-2837: ClassCastException in getProperties() 20498: Fix for ALF-2818: Failure to close index writer under certain conditions. - fix for index writer to close indexes when stopped by exceptions during FTS - fix FTS job to handle exceptions better - debug for FTS background operations 20499: ALF-3094: In ticket authenticate method in AuthenticationHelper, invalidate the current session if its cached ticket doesn't match 20500: Fix for ALF-2858 "Zero KB sized bin files will be created in the contentstore when new sites are created" (RECORD ONLY) 20503: AVMTestSuite: minor fixes to cleanup ctx usage (avoid re-loading) 20505: Merged BRANCHES/V2.2 to BRANCHES/V3.3 (record-only) 13859: (record-only) Removed dev from version label 14003: (record-only) Updated version to 2.2.5dev 14566: (record-only) ETWOTWO-1239 - remove workflow interpreter/console bootstrap 14572: (record-only) ETWOTWO-1239 - fix PersonTest to fix JBPMEngineTest (part-sourced from r13247) 14776: (record-only) Merged V3.1 to V2.2 14748: ETHREEOH-2225 - WCM upgrade (performance improvements for MySQL) 20506: NFS ReadDir/ReadDirPlus skips some folder entries. JLAN-98. 20507: Fixed issue with folder search resume id being reset to the wrong value during NFS folder search. Part of JLAN-98. 20508: Merged BRANCHES/V3.2 to BRANCHES/V3.3: 18319: Merged BRANCHES/DEV/BELARUS/V3.2-2010_01_11 to V3.2 18273: ETHREEOH-3834: WCM: An extral .xml.html file is created when editing newly created content 19182: Merged V3.1 to V3.2 18423: ETHREEOH-3850 - Content Manager unable to edit content items if there is a lock on a generated rendition 18432: (RECORD ONLY) Added FTP data port range configuration via <dataPorts>n:n</dataPorts> config value. ETHREEOH-4103. 18451: (RECORD ONLY) Fixed incorrect FTP debug level name. 18577: (RECORD ONLY) Fix for ETHREEOH-4117, based on CHK-11154 18792: Fix ETHREEOH-2729: Import of property with @ symbol in name fails with "start tag unexpected character @ " 19570: ALF-192 / ALF-1750: System Error if user trying submit web content based on web form which was deleted 19583: Merged DEV/BELARUS/V3.2-2010_03_17 to V3.2 19545: ALF-1954: Regression: same item can be submitted multiple times to workflow 19725: AVMStoreDescriptor - fix minor typo (for debugging) 19917: (RECORD ONLY) Merged HEAD to BRANCHES/V3.2: 19880: Fix ALF-898 - WCM: Deleting a file leads to error (only if RM/DOD installed) 19920: (RECORD ONLY) Merged HEAD to BRANCHES/V3.2: 19918: Fix ALF-2499 (Deleting a web project also deletes similarly named web projects - Potential Data Loss) 20509: Merged BRANCHES/V3.2 to BRANCHES/V3.3 (RECORD ONLY): 19825: (RECORD ONLY) Merged PATCHES/V3.2.r to BRANCHES/V3.2: 19804: Merged PATCHES/V3.2.0 to PATCHES/V3.2.r Merged HEAD to V3.2.0 ... 20510: Merged BRANCHES/V3.1 to BRANCHES/V3.3 (RECORD ONLY) 17482: (RECORD ONLY) Merged V3.2 to V3.1 17478: Fix ETHREEOH-3340 - WCM - Revert to snapshot failure (fix AVM getListing -> AVMSync compare -> WCM revertSnapshot) 18783: (RECORD ONLY) MT: ensure group (EMAIL_CONTRIBUTORS) bootstraps tenant admin user (when creating tenant) 20513: Added port change example for remote Alfresco server to share-config-custom.xml.sample 20518: ALF-657 Created tests to check that the 'runas' functionality works in the AlfrescoJavaScript action handler. Also modified the handler to run as the System user if no Authentication is currently set, as may occur if the action handler is being executed asynchronously. 20519: ALF-657 Created tests to check that the 'runas' functionality works in the AlfrescoJavaScript action handler. Also modified the handler to run as the System user if no Authentication is currently set, as may occur if the action handler is being executed asynchronously. 20520: Removed dev version.label 20522: ALF-3129: Map cm:organization property in LDAP as well as cm:organizationId, since cm:organization is what shows up in JSF and Share. Needed by ALF-2110. 20523: First part of fix for ALF-2110: - Appropriate Person and webframework metadata APIs now return information on immutability of Person properties (as some properties are immutable when synced to LDAP etc.) - Share client now correctly disables profile fields in User Profile and Admin User Console as appropriate based on individual user property mutability - Change Password button now correctly enabled/disabled based on account mutability 20524: VersionMigrator - option to run as scheduled job (ALF-1000) 20525: Fix for various IE6 CSS issues: ALF-3047 - It's impossible to destinate any action with data list item (IE6 specific) ALF-3049 - Incorrect layout of Manage aspects page ALF-3050 - Incorrect layout of Assign Workflow form 20526: Fix for ALF-2915 - Select > None feature for Data Lists not working across multiple pages in IE Closed ALF-2846 - DataList UI not fully I18Ned [Old prototype code] 20527: Fix for ALF-3082 - There is no Edit Offline action at Details page in Share site 20528: Fix various script errors due to typo: ALF-3088 - Script error occurs on creating duplicated record seria ALF-3012 - Incorrect behaviour on creating duplicating folders ALF-3004 - Script error when submitting an item with long data in Prioprity field 20529: Fix for ALF-3006 - Selected Items > Copy to... and Move to actions not working in Document Library 20530: Dynamic Models - fix test(s) - fix concurrency test for Oracle build (retry if txn lock cannot be acquired) - when getting deployed models, skip if invalid (eg. cannot be parsed) 20536: Remove @Override (ALF-657) 20537: Activities - (minor) fix NPE for Oracle build/test 20543: Final part of ALF-2110 - Appropriate person properties disabled for editing in Explorer Client if external mapped sync such as LDAP is used. Fixed issue with Change Password option being disabled incorrectly. 20544: Follow-up fix to r20528 20546: Fix for ALF-3151 - Freemarker causes NPE while deploying 3.3 enterprise onto WebSphere 7.0.0.7 - NOTE: will need to submit patch to freemarker.org 20552: Merged BRANCHES/V3.2 to BRANCHES/V3.3 (RECORD ONLY) 20551: (RECORD ONLY) Merged BRANCHES/V3.3 to BRANCHES/V3.2: 20090: Dynamic models: minor improvements to DictionaryModelType 20553: Fix for escalated issue ALF-2856: Space returns to browse view after completing Add Content dialog; need a way to return to custom view (applied patch provided by customer). 20554: Improvement to model delete validation (investigating intermittent failure of RepoAdminServiceImplTest.testSimpleDynamicModelViaNodeService) 20558: Merged DEV/BELARUS/V3.3-2010_06_08 to V3.3 20550: ALF-922: Mysql does not support unique keys that contain nulls as one would expect ...... duplicates in the alf_access_control_entry table 20562: ALF-3177 - security fix. 20563: Merged BRANCHES/V3.2 to BRANCHES/V3.3: 19412: Fix for ALF-865 "WCM / Cluster: unexpected error when concurrently submitting content" ALF-862 "WCM submit execution will require locking in a clustered WCM authoring env" 20564: Merged BRANCHES/V3.1 to BRANCHES/V3.3: 20542: Fixed ALF-3152: ImporterComponent transaction retry settings can cause IllegalArgumentException 20568: Follow-up on fix ALF-3152. Fix jobLockService's retryWaitIncrementMs git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@20572 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -13,6 +13,7 @@ function main()
|
|||||||
model.person = person;
|
model.person = person;
|
||||||
model.capabilities = people.getCapabilities(person);
|
model.capabilities = people.getCapabilities(person);
|
||||||
model.groups = groups ? people.getContainerGroups(person) : null;
|
model.groups = groups ? people.getContainerGroups(person) : null;
|
||||||
|
model.immutability = groups ? people.getImmutableProperties(userName) : null;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<#import "person.lib.ftl" as personLib/>
|
<#import "person.lib.ftl" as personLib/>
|
||||||
<#if groups??>
|
<#if groups??>
|
||||||
<@personLib.personGroupsJSON person=person groups=groups capabilities=capabilities />
|
<@personLib.personGroupsJSON person=person groups=groups capabilities=capabilities immutability=immutability />
|
||||||
<#else>
|
<#else>
|
||||||
<@personLib.personCapJSON person=person capabilities=capabilities />
|
<@personLib.personCapJSON person=person capabilities=capabilities />
|
||||||
</#if>
|
</#if>
|
@@ -46,7 +46,7 @@
|
|||||||
}
|
}
|
||||||
</#macro>
|
</#macro>
|
||||||
|
|
||||||
<#macro personGroupsJSON person groups capabilities>
|
<#macro personGroupsJSON person groups capabilities immutability>
|
||||||
<#escape x as jsonUtils.encodeJSONString(x)>
|
<#escape x as jsonUtils.encodeJSONString(x)>
|
||||||
{
|
{
|
||||||
<@personJSONinner person=person/>,
|
<@personJSONinner person=person/>,
|
||||||
@@ -61,7 +61,11 @@
|
|||||||
{
|
{
|
||||||
"itemName": "${authName}",
|
"itemName": "${authName}",
|
||||||
"displayName": "${displayName}"
|
"displayName": "${displayName}"
|
||||||
}<#if g_has_next>,</#if></#list>]
|
}<#if g_has_next>,</#if></#list>],
|
||||||
|
"immutability":
|
||||||
|
{
|
||||||
|
<@serializeHash hash=immutability/>
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</#escape>
|
</#escape>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
@@ -10,16 +10,35 @@ function getPerson(username)
|
|||||||
if (typeof PeopleCache[username] == "undefined")
|
if (typeof PeopleCache[username] == "undefined")
|
||||||
{
|
{
|
||||||
var person = people.getPerson(username);
|
var person = people.getPerson(username);
|
||||||
if (person == null && (username == "System" || username.match("^System@") == "System@"))
|
if (person == null)
|
||||||
{
|
{
|
||||||
person =
|
if (username == "System" || username.match("^System@") == "System@")
|
||||||
{
|
{
|
||||||
properties:
|
// special case for the System users
|
||||||
|
person =
|
||||||
{
|
{
|
||||||
userName: "System",
|
properties:
|
||||||
firstName: "System",
|
{
|
||||||
lastName: "User"
|
userName: "System",
|
||||||
}
|
firstName: "System",
|
||||||
|
lastName: "User"
|
||||||
|
},
|
||||||
|
assocs: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// missing person - may have been deleted from the database
|
||||||
|
person =
|
||||||
|
{
|
||||||
|
properties:
|
||||||
|
{
|
||||||
|
userName: username,
|
||||||
|
firstName: "",
|
||||||
|
lastName: ""
|
||||||
|
},
|
||||||
|
assocs: {}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
PeopleCache[username] =
|
PeopleCache[username] =
|
||||||
|
@@ -0,0 +1,10 @@
|
|||||||
|
<webscript>
|
||||||
|
<shortname>Get the content of the specified asset within the specified web project and sandbox.</shortname>
|
||||||
|
<url>/api/wcm/webprojects/{webprojectref}/sandboxes/{sandboxref}/assets/content/{path}</url>
|
||||||
|
<url>/api/wcm/webprojects/{webprojectref}/sandboxes/{sandboxref}/assets/content/{path}?webApp={webApp?}</url>
|
||||||
|
<format default="json">argument</format>
|
||||||
|
<authentication>user</authentication>
|
||||||
|
<transaction>required</transaction>
|
||||||
|
<family>WCM/Asset</family>
|
||||||
|
<lifecycle>draft_public_api</lifecycle>
|
||||||
|
</webscript>
|
@@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* Get asset content script
|
||||||
|
*/
|
||||||
|
function main()
|
||||||
|
{
|
||||||
|
var urlElements = url.extension.split("/");
|
||||||
|
var shortName = urlElements[0];
|
||||||
|
var boxName = urlElements[2];
|
||||||
|
var pathArray = urlElements.slice(5);
|
||||||
|
var path = pathArray.join("/");
|
||||||
|
|
||||||
|
var webproject = webprojects.getWebProject(shortName);
|
||||||
|
if (null == webproject)
|
||||||
|
{
|
||||||
|
// Site cannot be found
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "The webproject '" + shortName + "' does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var sandbox;
|
||||||
|
sandbox = webproject.getSandbox(boxName);
|
||||||
|
if (null == sandbox)
|
||||||
|
{
|
||||||
|
// Site cannot be found
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "The sandbox '" + boxName + "' in webproject '" + shortName + "' does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var webApp = args["webApp"];
|
||||||
|
|
||||||
|
var asset;
|
||||||
|
|
||||||
|
if(null != webApp)
|
||||||
|
{
|
||||||
|
asset = sandbox.getAssetWebApp(webApp, path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
asset = sandbox.getAsset(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null == asset)
|
||||||
|
{
|
||||||
|
// Site cannot be found
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "The asset '" + path + "' in webproject '" + shortName + "' does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// set model properties
|
||||||
|
model.sandbox = sandbox;
|
||||||
|
model.webproject = asset.getContent();
|
||||||
|
model.asset = asset;
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
@@ -0,0 +1,4 @@
|
|||||||
|
<#import "asset.lib.ftl" as assetLib/>
|
||||||
|
{
|
||||||
|
"content": "${asset.content}"
|
||||||
|
}
|
@@ -0,0 +1,9 @@
|
|||||||
|
<webscript>
|
||||||
|
<shortname>Update a WCM asset</shortname>
|
||||||
|
<url>/api/wcm/webprojects/{webprojectref}/sandboxes/{sandboxref}/assets/properties/{path}</url>
|
||||||
|
<format default="json">argument</format>
|
||||||
|
<authentication>user</authentication>
|
||||||
|
<transaction>required</transaction>
|
||||||
|
<family>WCM/Asset</family>
|
||||||
|
<lifecycle>draft_public_api</lifecycle>
|
||||||
|
</webscript>
|
@@ -0,0 +1,4 @@
|
|||||||
|
<#import "asset.lib.ftl" as assetLib/>
|
||||||
|
{
|
||||||
|
data: <@assetLib.assetJSON asset=asset depth=0/>
|
||||||
|
}
|
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Post -update a asset file/folder
|
||||||
|
* optionally updates simple content
|
||||||
|
*/
|
||||||
|
function main()
|
||||||
|
{
|
||||||
|
var urlElements = url.extension.split("/");
|
||||||
|
var shortName = urlElements[0];
|
||||||
|
var boxName = urlElements[2];
|
||||||
|
var pathArray = urlElements.slice(5);
|
||||||
|
var path = pathArray.join("/");
|
||||||
|
|
||||||
|
var webproject = webprojects.getWebProject(shortName);
|
||||||
|
if (null == webproject)
|
||||||
|
{
|
||||||
|
// Site cannot be found
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "The webproject, " + shortName + ", does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var sandbox = webproject.getSandbox(boxName);
|
||||||
|
if (null == sandbox)
|
||||||
|
{
|
||||||
|
// Site cannot be found
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "The sandbox, " + boxName + ", in webproject, " + shortName + ", does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var asset = sandbox.getAsset(path);
|
||||||
|
|
||||||
|
if (null == asset)
|
||||||
|
{
|
||||||
|
status.setCode(status.STATUS_NOT_FOUND, "The asset, " + path + ", in webproject, " + shortName + ", does not exist.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now read the values from the json form
|
||||||
|
// if(!json.has("properties"))
|
||||||
|
// {
|
||||||
|
// status.setCode(status.BAD_REQUEST, "JSON property 'properties' must specified");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
|
|
||||||
|
var properties = null;
|
||||||
|
if (json.has("properties"))
|
||||||
|
{
|
||||||
|
properties = json.get("properties");
|
||||||
|
}
|
||||||
|
var content = null;
|
||||||
|
|
||||||
|
if(json.has("content"))
|
||||||
|
{
|
||||||
|
content = json.get("content");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (null != properties)
|
||||||
|
{
|
||||||
|
asset.setProperties(properties);
|
||||||
|
asset.save();
|
||||||
|
}
|
||||||
|
if (null != content)
|
||||||
|
{
|
||||||
|
asset.writeContent(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
// set model properties
|
||||||
|
model.sandbox = sandbox;
|
||||||
|
model.webproject = webproject;
|
||||||
|
model.asset = asset;
|
||||||
|
|
||||||
|
status.code = status.STATUS_ACCEPTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
main();
|
@@ -40,18 +40,36 @@ var Common =
|
|||||||
if (typeof Common.PeopleCache[username] == "undefined")
|
if (typeof Common.PeopleCache[username] == "undefined")
|
||||||
{
|
{
|
||||||
var person = people.getPerson(username);
|
var person = people.getPerson(username);
|
||||||
if (person == null && (username == "System" || username.match("^System@") == "System@"))
|
if (person == null)
|
||||||
{
|
{
|
||||||
person =
|
if (username == "System" || username.match("^System@") == "System@")
|
||||||
{
|
{
|
||||||
properties:
|
// special case for the System users
|
||||||
|
person =
|
||||||
{
|
{
|
||||||
userName: "System",
|
properties:
|
||||||
firstName: "System",
|
{
|
||||||
lastName: "User"
|
userName: "System",
|
||||||
},
|
firstName: "System",
|
||||||
assocs: {}
|
lastName: "User"
|
||||||
};
|
},
|
||||||
|
assocs: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// missing person - may have been deleted from the database
|
||||||
|
person =
|
||||||
|
{
|
||||||
|
properties:
|
||||||
|
{
|
||||||
|
userName: username,
|
||||||
|
firstName: "",
|
||||||
|
lastName: ""
|
||||||
|
},
|
||||||
|
assocs: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Common.PeopleCache[username] =
|
Common.PeopleCache[username] =
|
||||||
{
|
{
|
||||||
|
@@ -114,42 +114,45 @@ function getDoclist()
|
|||||||
{
|
{
|
||||||
// Get evaluated properties.
|
// Get evaluated properties.
|
||||||
item = Evaluator.run(node);
|
item = Evaluator.run(node);
|
||||||
item.isFavourite = (favourites[item.node.nodeRef] === true);
|
if (item !== null)
|
||||||
|
|
||||||
// Does this collection of nodes have potentially differering paths?
|
|
||||||
if (filterParams.variablePath || item.isLink)
|
|
||||||
{
|
{
|
||||||
locationNode = (item.isLink && item.type == "document") ? item.linkNode : item.node;
|
item.isFavourite = (favourites[item.node.nodeRef] === true);
|
||||||
location = Common.getLocation(locationNode);
|
|
||||||
}
|
// Does this collection of nodes have potentially differering paths?
|
||||||
else
|
if (filterParams.variablePath || item.isLink)
|
||||||
{
|
|
||||||
location =
|
|
||||||
{
|
{
|
||||||
site: parsedArgs.location.site,
|
locationNode = (item.isLink && item.type == "document") ? item.linkNode : item.node;
|
||||||
siteTitle: parsedArgs.location.siteTitle,
|
location = Common.getLocation(locationNode);
|
||||||
container: parsedArgs.location.container,
|
|
||||||
path: parsedArgs.location.path,
|
|
||||||
file: node.name
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Resolved location
|
|
||||||
item.location = location;
|
|
||||||
|
|
||||||
// Is our thumbnail type registered?
|
|
||||||
if (isThumbnailNameRegistered)
|
|
||||||
{
|
|
||||||
// Make sure we have a thumbnail.
|
|
||||||
thumbnail = item.node.getThumbnail(THUMBNAIL_NAME);
|
|
||||||
if (thumbnail === null)
|
|
||||||
{
|
|
||||||
// No thumbnail, so queue creation
|
|
||||||
item.node.createThumbnail(THUMBNAIL_NAME, true);
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
location =
|
||||||
|
{
|
||||||
|
site: parsedArgs.location.site,
|
||||||
|
siteTitle: parsedArgs.location.siteTitle,
|
||||||
|
container: parsedArgs.location.container,
|
||||||
|
path: parsedArgs.location.path,
|
||||||
|
file: node.name
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// Resolved location
|
||||||
|
item.location = location;
|
||||||
|
|
||||||
|
// Is our thumbnail type registered?
|
||||||
|
if (isThumbnailNameRegistered)
|
||||||
|
{
|
||||||
|
// Make sure we have a thumbnail.
|
||||||
|
thumbnail = item.node.getThumbnail(THUMBNAIL_NAME);
|
||||||
|
if (thumbnail === null)
|
||||||
|
{
|
||||||
|
// No thumbnail, so queue creation
|
||||||
|
item.node.createThumbnail(THUMBNAIL_NAME, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
items.push(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
items.push(item);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
@@ -108,8 +108,11 @@ var Evaluator =
|
|||||||
*/
|
*/
|
||||||
linkNode = node;
|
linkNode = node;
|
||||||
node = linkNode.properties.destination;
|
node = linkNode.properties.destination;
|
||||||
// Re-evaluate the nodeType based on the link's destination node
|
if (node !== null)
|
||||||
nodeType = Evaluator.getNodeType(node);
|
{
|
||||||
|
// Re-evaluate the nodeType based on the link's destination node
|
||||||
|
nodeType = Evaluator.getNodeType(node);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -247,32 +250,39 @@ var Evaluator =
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Part of an active workflow? Guard against stale worklow tasks.
|
if (node !== null)
|
||||||
try
|
|
||||||
{
|
{
|
||||||
for each (activeWorkflow in node.activeWorkflows)
|
// Part of an active workflow? Guard against stale worklow tasks.
|
||||||
|
try
|
||||||
{
|
{
|
||||||
activeWorkflows.push(activeWorkflow.id);
|
for each (activeWorkflow in node.activeWorkflows)
|
||||||
|
{
|
||||||
|
activeWorkflows.push(activeWorkflow.id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
catch (e) {}
|
||||||
|
|
||||||
|
return(
|
||||||
|
{
|
||||||
|
node: node,
|
||||||
|
type: nodeType,
|
||||||
|
linkNode: linkNode,
|
||||||
|
isLink: isLink,
|
||||||
|
status: status,
|
||||||
|
actionSet: actionSet,
|
||||||
|
actionPermissions: permissions,
|
||||||
|
createdBy: createdBy,
|
||||||
|
modifiedBy: modifiedBy,
|
||||||
|
lockedBy: lockedBy,
|
||||||
|
tags: node.tags,
|
||||||
|
activeWorkflows: activeWorkflows,
|
||||||
|
custom: jsonUtils.toJSONString(custom),
|
||||||
|
actionLabels: actionLabels
|
||||||
|
});
|
||||||
}
|
}
|
||||||
catch (e) {}
|
else
|
||||||
|
|
||||||
return(
|
|
||||||
{
|
{
|
||||||
node: node,
|
return null;
|
||||||
type: nodeType,
|
}
|
||||||
linkNode: linkNode,
|
|
||||||
isLink: isLink,
|
|
||||||
status: status,
|
|
||||||
actionSet: actionSet,
|
|
||||||
actionPermissions: permissions,
|
|
||||||
createdBy: createdBy,
|
|
||||||
modifiedBy: modifiedBy,
|
|
||||||
lockedBy: lockedBy,
|
|
||||||
tags: node.tags,
|
|
||||||
activeWorkflows: activeWorkflows,
|
|
||||||
custom: jsonUtils.toJSONString(custom),
|
|
||||||
actionLabels: actionLabels
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@@ -26,18 +26,36 @@ var Common =
|
|||||||
if (typeof Common.PeopleCache[username] == "undefined")
|
if (typeof Common.PeopleCache[username] == "undefined")
|
||||||
{
|
{
|
||||||
var person = people.getPerson(username);
|
var person = people.getPerson(username);
|
||||||
if (person == null && (username == "System" || username.match("^System@") == "System@"))
|
if (person == null)
|
||||||
{
|
{
|
||||||
person =
|
if (username == "System" || username.match("^System@") == "System@")
|
||||||
{
|
{
|
||||||
properties:
|
// special case for the System users
|
||||||
|
person =
|
||||||
{
|
{
|
||||||
userName: "System",
|
properties:
|
||||||
firstName: "System",
|
{
|
||||||
lastName: "User"
|
userName: "System",
|
||||||
},
|
firstName: "System",
|
||||||
assocs: {}
|
lastName: "User"
|
||||||
};
|
},
|
||||||
|
assocs: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// missing person - may have been deleted from the database
|
||||||
|
person =
|
||||||
|
{
|
||||||
|
properties:
|
||||||
|
{
|
||||||
|
userName: username,
|
||||||
|
firstName: "",
|
||||||
|
lastName: ""
|
||||||
|
},
|
||||||
|
assocs: {}
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Common.PeopleCache[username] =
|
Common.PeopleCache[username] =
|
||||||
{
|
{
|
||||||
|
@@ -86,6 +86,11 @@
|
|||||||
{
|
{
|
||||||
<@serializeHash hash=capabilities/>
|
<@serializeHash hash=capabilities/>
|
||||||
}
|
}
|
||||||
|
,
|
||||||
|
"immutableProperties":
|
||||||
|
{
|
||||||
|
<@serializeHash hash=immutableProperties/>
|
||||||
|
}
|
||||||
</#if>
|
</#if>
|
||||||
</#escape>
|
</#escape>
|
||||||
</#macro>
|
</#macro>
|
||||||
|
@@ -21,6 +21,7 @@ else if (args["user"] != null)
|
|||||||
model.isUser = true;
|
model.isUser = true;
|
||||||
model.includeChildren = false;
|
model.includeChildren = false;
|
||||||
model.capabilities = people.getCapabilities(object);
|
model.capabilities = people.getCapabilities(object);
|
||||||
|
model.immutableProperties = people.getImmutableProperties(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// load content by relative path
|
// load content by relative path
|
||||||
|
@@ -568,12 +568,26 @@ public class PropertyUtil
|
|||||||
{
|
{
|
||||||
for (Object propertyValue : (Collection<Object>) value)
|
for (Object propertyValue : (Collection<Object>) value)
|
||||||
{
|
{
|
||||||
property.getValue().add(BigInteger.valueOf((Long) propertyValue));
|
if(propertyValue instanceof Long)
|
||||||
|
{
|
||||||
|
property.getValue().add(BigInteger.valueOf((Long) propertyValue));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
property.getValue().add(BigInteger.valueOf((Integer) propertyValue));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
property.getValue().add(BigInteger.valueOf((Long) value));
|
if(value instanceof Long)
|
||||||
|
{
|
||||||
|
property.getValue().add(BigInteger.valueOf((Long) value));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
property.getValue().add(BigInteger.valueOf((Integer) value));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return property;
|
return property;
|
||||||
|
@@ -20,6 +20,8 @@
|
|||||||
package org.alfresco.repo.web.scripts.wcm.sandbox;
|
package org.alfresco.repo.web.scripts.wcm.sandbox;
|
||||||
|
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -31,6 +33,7 @@ import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
|||||||
import org.alfresco.service.cmr.security.PersonService;
|
import org.alfresco.service.cmr.security.PersonService;
|
||||||
import org.alfresco.util.PropertyMap;
|
import org.alfresco.util.PropertyMap;
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONException;
|
||||||
import org.json.JSONObject;
|
import org.json.JSONObject;
|
||||||
import org.springframework.extensions.webscripts.Status;
|
import org.springframework.extensions.webscripts.Status;
|
||||||
import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest;
|
import org.springframework.extensions.webscripts.TestWebScriptServer.DeleteRequest;
|
||||||
@@ -68,7 +71,18 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
private static final String WEBAPP_ROOT = "ROOT";
|
private static final String WEBAPP_ROOT = "ROOT";
|
||||||
private static final String WEBAPP_YELLOW = "YELLOW";
|
private static final String WEBAPP_YELLOW = "YELLOW";
|
||||||
private static final String WEBAPP_GREEN = "GREEN";
|
private static final String WEBAPP_GREEN = "GREEN";
|
||||||
|
|
||||||
|
private static final String ROOT_FILE = "index.htm";
|
||||||
|
|
||||||
|
private static final String FIELD_DATA = "data";
|
||||||
|
private static final String FIELD_PROPERTIES = "properties";
|
||||||
|
private static final String FIELD_CONTENT = "content";
|
||||||
|
|
||||||
|
private static final String PROP_NAME = "cm:name";
|
||||||
|
private static final String PROP_TITLE = "cm:title";
|
||||||
|
|
||||||
|
private static final String TEST_CONTENT_ENTRY = "This is test content entry for an Asset";
|
||||||
|
|
||||||
// override jbpm.job.executor idleInterval to 5s (was 1.5m) for WCM unit tests
|
// override jbpm.job.executor idleInterval to 5s (was 1.5m) for WCM unit tests
|
||||||
private static final String SUBMIT_CONFIG_LOCATION = "classpath:wcm/wcm-jbpm-context.xml";
|
private static final String SUBMIT_CONFIG_LOCATION = "classpath:wcm/wcm-jbpm-context.xml";
|
||||||
private static final long SUBMIT_DELAY = 15000L; // (in millis) 15s - to allow time for async submit workflow to complete (as per 5s idleInterval above)
|
private static final long SUBMIT_DELAY = 15000L; // (in millis) 15s - to allow time for async submit workflow to complete (as per 5s idleInterval above)
|
||||||
@@ -133,7 +147,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
Response response = sendRequest(new PostRequest(URL_WEB_PROJECT, webProj.toString(), "application/json"), Status.STATUS_OK);
|
Response response = sendRequest(new PostRequest(URL_WEB_PROJECT, webProj.toString(), "application/json"), Status.STATUS_OK);
|
||||||
|
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject data = result.getJSONObject("data");
|
JSONObject data = result.getJSONObject(FIELD_DATA);
|
||||||
String webProjectRef = data.getString("webprojectref");
|
String webProjectRef = data.getString("webprojectref");
|
||||||
|
|
||||||
assertNotNull("webproject ref is null", webProjectRef);
|
assertNotNull("webproject ref is null", webProjectRef);
|
||||||
@@ -171,7 +185,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String validURL = "/api/wcm/webprojects/" + webprojref + "/sandboxes";
|
String validURL = "/api/wcm/webprojects/" + webprojref + "/sandboxes";
|
||||||
Response response = sendRequest(new PostRequest(validURL, box.toString(), "application/json"), Status.STATUS_OK);
|
Response response = sendRequest(new PostRequest(validURL, box.toString(), "application/json"), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject data = result.getJSONObject("data");
|
JSONObject data = result.getJSONObject(FIELD_DATA);
|
||||||
sandboxref = data.getString("sandboxref");
|
sandboxref = data.getString("sandboxref");
|
||||||
assertNotNull("sandboxref is null", sandboxref);
|
assertNotNull("sandboxref is null", sandboxref);
|
||||||
}
|
}
|
||||||
@@ -184,7 +198,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
assertTrue("sandbox is not empty", lookupResult.length() == 0);
|
assertTrue("sandbox is not empty", lookupResult.length() == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -246,7 +260,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
System.out.println(list.getContentAsString());
|
System.out.println(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() == 1);
|
assertTrue("testListUserSandbox", lookupResult.length() == 1);
|
||||||
|
|
||||||
@@ -289,7 +303,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() == 0);
|
assertTrue("testListUserSandbox", lookupResult.length() == 0);
|
||||||
}
|
}
|
||||||
@@ -322,7 +336,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() == 1);
|
assertTrue("testListUserSandbox", lookupResult.length() == 1);
|
||||||
|
|
||||||
@@ -359,7 +373,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() == 2);
|
assertTrue("testListUserSandbox", lookupResult.length() == 2);
|
||||||
}
|
}
|
||||||
@@ -379,7 +393,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() == 3);
|
assertTrue("testListUserSandbox", lookupResult.length() == 3);
|
||||||
}
|
}
|
||||||
@@ -472,7 +486,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
||||||
}
|
}
|
||||||
@@ -518,7 +532,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
||||||
|
|
||||||
@@ -555,7 +569,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
||||||
|
|
||||||
@@ -598,7 +612,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
JSONArray assets = new JSONArray();
|
JSONArray assets = new JSONArray();
|
||||||
JSONArray paths = new JSONArray();
|
JSONArray paths = new JSONArray();
|
||||||
JSONArray omitted = new JSONArray();
|
JSONArray omitted = new JSONArray();
|
||||||
@@ -638,7 +652,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
|
|
||||||
Response listTwo = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response listTwo = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject resultTwo = new JSONObject(listTwo.getContentAsString());
|
JSONObject resultTwo = new JSONObject(listTwo.getContentAsString());
|
||||||
JSONArray lookupResultTwo = resultTwo.getJSONArray("data");
|
JSONArray lookupResultTwo = resultTwo.getJSONArray(FIELD_DATA);
|
||||||
assertTrue("testListUserSandbox", lookupResultTwo.length() == 2);
|
assertTrue("testListUserSandbox", lookupResultTwo.length() == 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -701,7 +715,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertEquals("testListUserSandbox", lookupResult.length(), 1);
|
assertEquals("testListUserSandbox", lookupResult.length(), 1);
|
||||||
|
|
||||||
@@ -771,7 +785,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
||||||
}
|
}
|
||||||
@@ -808,7 +822,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
||||||
|
|
||||||
@@ -838,7 +852,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
assertTrue("testListUserSandbox", lookupResult.length() > 0);
|
||||||
|
|
||||||
@@ -897,7 +911,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
JSONArray assets = new JSONArray();
|
JSONArray assets = new JSONArray();
|
||||||
JSONArray paths = new JSONArray();
|
JSONArray paths = new JSONArray();
|
||||||
JSONArray omitted = new JSONArray();
|
JSONArray omitted = new JSONArray();
|
||||||
@@ -933,7 +947,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
|
|
||||||
Response listTwo = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response listTwo = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject resultTwo = new JSONObject(listTwo.getContentAsString());
|
JSONObject resultTwo = new JSONObject(listTwo.getContentAsString());
|
||||||
JSONArray lookupResultTwo = resultTwo.getJSONArray("data");
|
JSONArray lookupResultTwo = resultTwo.getJSONArray(FIELD_DATA);
|
||||||
assertTrue("testListUserSandbox", lookupResultTwo.length() == 2);
|
assertTrue("testListUserSandbox", lookupResultTwo.length() == 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -992,7 +1006,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
String sandboxesURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/modified";
|
||||||
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
Response list = sendRequest(new GetRequest(sandboxesURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(list.getContentAsString());
|
JSONObject result = new JSONObject(list.getContentAsString());
|
||||||
JSONArray lookupResult = result.getJSONArray("data");
|
JSONArray lookupResult = result.getJSONArray(FIELD_DATA);
|
||||||
|
|
||||||
assertTrue("testListUserSandbox", lookupResult.length() == 1);
|
assertTrue("testListUserSandbox", lookupResult.length() == 1);
|
||||||
|
|
||||||
@@ -1008,7 +1022,6 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
public void testGetAsset() throws Exception
|
public void testGetAsset() throws Exception
|
||||||
{
|
{
|
||||||
final String YELLOW_FILE = "YellowFile.xyz";
|
final String YELLOW_FILE = "YellowFile.xyz";
|
||||||
final String ROOT_FILE = "index.htm";
|
|
||||||
|
|
||||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
String webprojref = createWebProject();
|
String webprojref = createWebProject();
|
||||||
@@ -1036,7 +1049,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
Response root = sendRequest(new GetRequest(rootURL), Status.STATUS_OK);
|
Response root = sendRequest(new GetRequest(rootURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(root.getContentAsString());
|
JSONObject result = new JSONObject(root.getContentAsString());
|
||||||
System.out.println(root.getContentAsString());
|
System.out.println(root.getContentAsString());
|
||||||
JSONObject rootDir = result.getJSONObject("data");
|
JSONObject rootDir = result.getJSONObject(FIELD_DATA);
|
||||||
String name = rootDir.getString("name");
|
String name = rootDir.getString("name");
|
||||||
JSONArray children = rootDir.getJSONArray("children");
|
JSONArray children = rootDir.getJSONArray("children");
|
||||||
assertEquals("name is wrong", WEBAPP_ROOT, name);
|
assertEquals("name is wrong", WEBAPP_ROOT, name);
|
||||||
@@ -1050,7 +1063,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String yellowURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets" + "/www/avm_webapps/" + WEBAPP_YELLOW + "/" + YELLOW_FILE ;
|
String yellowURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets" + "/www/avm_webapps/" + WEBAPP_YELLOW + "/" + YELLOW_FILE ;
|
||||||
Response yellow = sendRequest(new GetRequest(yellowURL), Status.STATUS_OK);
|
Response yellow = sendRequest(new GetRequest(yellowURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(yellow.getContentAsString());
|
JSONObject result = new JSONObject(yellow.getContentAsString());
|
||||||
JSONObject yellowFile = result.getJSONObject("data");
|
JSONObject yellowFile = result.getJSONObject(FIELD_DATA);
|
||||||
String name = yellowFile.getString("name");
|
String name = yellowFile.getString("name");
|
||||||
long version = yellowFile.getLong("version");
|
long version = yellowFile.getLong("version");
|
||||||
long fileSize = yellowFile.getLong("fileSize");
|
long fileSize = yellowFile.getLong("fileSize");
|
||||||
@@ -1064,7 +1077,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
String yellowURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets" + "/" + YELLOW_FILE +"?webApp="+ WEBAPP_YELLOW;
|
String yellowURL = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets" + "/" + YELLOW_FILE +"?webApp="+ WEBAPP_YELLOW;
|
||||||
Response yellow = sendRequest(new GetRequest(yellowURL), Status.STATUS_OK);
|
Response yellow = sendRequest(new GetRequest(yellowURL), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(yellow.getContentAsString());
|
JSONObject result = new JSONObject(yellow.getContentAsString());
|
||||||
JSONObject yellowFile = result.getJSONObject("data");
|
JSONObject yellowFile = result.getJSONObject(FIELD_DATA);
|
||||||
String name = yellowFile.getString("name");
|
String name = yellowFile.getString("name");
|
||||||
long version = yellowFile.getLong("version");
|
long version = yellowFile.getLong("version");
|
||||||
long fileSize = yellowFile.getLong("fileSize");
|
long fileSize = yellowFile.getLong("fileSize");
|
||||||
@@ -1110,7 +1123,6 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
{
|
{
|
||||||
final String YELLOW_FILE = "YellowFile.xyz";
|
final String YELLOW_FILE = "YellowFile.xyz";
|
||||||
final String YELLOW_FILE2 = "Buffy.jpg";
|
final String YELLOW_FILE2 = "Buffy.jpg";
|
||||||
final String ROOT_FILE = "index.htm";
|
|
||||||
|
|
||||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
String webprojref = createWebProject();
|
String webprojref = createWebProject();
|
||||||
@@ -1197,7 +1209,6 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
public void testCreateAsset() throws Exception
|
public void testCreateAsset() throws Exception
|
||||||
{
|
{
|
||||||
final String YELLOW_FILE = "YellowFile.xyz";
|
final String YELLOW_FILE = "YellowFile.xyz";
|
||||||
final String ROOT_FILE = "index.htm";
|
|
||||||
|
|
||||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
String webprojref = createWebProject();
|
String webprojref = createWebProject();
|
||||||
@@ -1215,7 +1226,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
|
|
||||||
Response response = sendRequest(new PostRequest(rootURL, submitForm.toString(), "application/json"), Status.STATUS_CREATED);
|
Response response = sendRequest(new PostRequest(rootURL, submitForm.toString(), "application/json"), Status.STATUS_CREATED);
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject lookupResult = result.getJSONObject("data");
|
JSONObject lookupResult = result.getJSONObject(FIELD_DATA);
|
||||||
String name = lookupResult.getString("name");
|
String name = lookupResult.getString("name");
|
||||||
boolean isFolder = lookupResult.getBoolean("isFolder");
|
boolean isFolder = lookupResult.getBoolean("isFolder");
|
||||||
boolean isFile = lookupResult.getBoolean("isFile");
|
boolean isFile = lookupResult.getBoolean("isFile");
|
||||||
@@ -1234,10 +1245,10 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
JSONObject submitForm = new JSONObject();
|
JSONObject submitForm = new JSONObject();
|
||||||
submitForm.put("name", ROOT_FILE);
|
submitForm.put("name", ROOT_FILE);
|
||||||
submitForm.put("type", "file");
|
submitForm.put("type", "file");
|
||||||
submitForm.put("content", "Hello World");
|
submitForm.put(FIELD_CONTENT, "Hello World");
|
||||||
Response response = sendRequest(new PostRequest(rootURL, submitForm.toString(), "application/json"), Status.STATUS_CREATED);
|
Response response = sendRequest(new PostRequest(rootURL, submitForm.toString(), "application/json"), Status.STATUS_CREATED);
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject lookupResult = result.getJSONObject("data");
|
JSONObject lookupResult = result.getJSONObject(FIELD_DATA);
|
||||||
String name = lookupResult.getString("name");
|
String name = lookupResult.getString("name");
|
||||||
long fileSize = lookupResult.getLong("fileSize");
|
long fileSize = lookupResult.getLong("fileSize");
|
||||||
assertEquals("name is wrong", ROOT_FILE, name);
|
assertEquals("name is wrong", ROOT_FILE, name);
|
||||||
@@ -1281,7 +1292,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
submitForm.put("type", "file");
|
submitForm.put("type", "file");
|
||||||
Response response = sendRequest(new PostRequest(rootURL, submitForm.toString(), "application/json"), Status.STATUS_CREATED);
|
Response response = sendRequest(new PostRequest(rootURL, submitForm.toString(), "application/json"), Status.STATUS_CREATED);
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject lookupResult = result.getJSONObject("data");
|
JSONObject lookupResult = result.getJSONObject(FIELD_DATA);
|
||||||
String name = lookupResult.getString("name");
|
String name = lookupResult.getString("name");
|
||||||
String path = lookupResult.getString("path");
|
String path = lookupResult.getString("path");
|
||||||
assertEquals("name not correct", name, "dawn.jpg");
|
assertEquals("name not correct", name, "dawn.jpg");
|
||||||
@@ -1299,7 +1310,6 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
public void testRenameAsset() throws Exception
|
public void testRenameAsset() throws Exception
|
||||||
{
|
{
|
||||||
final String YELLOW_FILE = "buffy.jpg";
|
final String YELLOW_FILE = "buffy.jpg";
|
||||||
final String ROOT_FILE = "index.htm";
|
|
||||||
final String PURPLE_FILE = "buffy.htm";
|
final String PURPLE_FILE = "buffy.htm";
|
||||||
final String PURPLE_FILE2 = "willow.htm";
|
final String PURPLE_FILE2 = "willow.htm";
|
||||||
final String ROOT_MOVED_FILE = "smashing.htm";
|
final String ROOT_MOVED_FILE = "smashing.htm";
|
||||||
@@ -1321,7 +1331,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
submitForm.put("name", WEBAPP_GREEN);
|
submitForm.put("name", WEBAPP_GREEN);
|
||||||
Response response = sendRequest(new PutRequest(yellowURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
Response response = sendRequest(new PutRequest(yellowURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject lookupResult = result.getJSONObject("data");
|
JSONObject lookupResult = result.getJSONObject(FIELD_DATA);
|
||||||
String name = lookupResult.getString("name");
|
String name = lookupResult.getString("name");
|
||||||
assertEquals("name is wrong", WEBAPP_GREEN, name);
|
assertEquals("name is wrong", WEBAPP_GREEN, name);
|
||||||
}
|
}
|
||||||
@@ -1337,7 +1347,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
submitForm.put("name", ROOT_MOVED_FILE);
|
submitForm.put("name", ROOT_MOVED_FILE);
|
||||||
Response response = sendRequest(new PutRequest(yellowURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
Response response = sendRequest(new PutRequest(yellowURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject lookupResult = result.getJSONObject("data");
|
JSONObject lookupResult = result.getJSONObject(FIELD_DATA);
|
||||||
String name = lookupResult.getString("name");
|
String name = lookupResult.getString("name");
|
||||||
assertEquals("name is wrong", ROOT_MOVED_FILE, name);
|
assertEquals("name is wrong", ROOT_MOVED_FILE, name);
|
||||||
|
|
||||||
@@ -1358,7 +1368,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
submitForm.put("name", PURPLE_FILE2);
|
submitForm.put("name", PURPLE_FILE2);
|
||||||
Response response = sendRequest(new PutRequest(purpleURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
Response response = sendRequest(new PutRequest(purpleURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject lookupResult = result.getJSONObject("data");
|
JSONObject lookupResult = result.getJSONObject(FIELD_DATA);
|
||||||
String name = lookupResult.getString("name");
|
String name = lookupResult.getString("name");
|
||||||
assertEquals("name is wrong", PURPLE_FILE2, name);
|
assertEquals("name is wrong", PURPLE_FILE2, name);
|
||||||
}
|
}
|
||||||
@@ -1382,7 +1392,6 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
public void testMoveAsset() throws Exception
|
public void testMoveAsset() throws Exception
|
||||||
{
|
{
|
||||||
final String YELLOW_FILE = "buffy.jpg";
|
final String YELLOW_FILE = "buffy.jpg";
|
||||||
final String ROOT_FILE = "index.htm";
|
|
||||||
|
|
||||||
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
String webprojref = createWebProject();
|
String webprojref = createWebProject();
|
||||||
@@ -1403,7 +1412,7 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
Response response = sendRequest(new PutRequest(myURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
Response response = sendRequest(new PutRequest(myURL, submitForm.toString(), "application/json"), Status.STATUS_OK);
|
||||||
System.out.println(response.getContentAsString());
|
System.out.println(response.getContentAsString());
|
||||||
JSONObject result = new JSONObject(response.getContentAsString());
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
JSONObject lookupResult = result.getJSONObject("data");
|
JSONObject lookupResult = result.getJSONObject(FIELD_DATA);
|
||||||
String name = lookupResult.getString("name");
|
String name = lookupResult.getString("name");
|
||||||
assertEquals("name is wrong", ROOT_FILE, name);
|
assertEquals("name is wrong", ROOT_FILE, name);
|
||||||
|
|
||||||
@@ -1413,7 +1422,84 @@ public class AssetTest extends BaseWebScriptTest {
|
|||||||
sendRequest(new PutRequest(myURL, submitForm.toString(), "application/json"), Status.STATUS_NOT_FOUND);
|
sendRequest(new PutRequest(myURL, submitForm.toString(), "application/json"), Status.STATUS_NOT_FOUND);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests updating properties of an Asset
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void testUpdateAssetProperties() throws Exception
|
||||||
|
{
|
||||||
|
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
String webprojref = createWebProject();
|
||||||
|
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||||
|
String sandboxref = createSandbox(webprojref, AuthenticationUtil.getAdminUserName());
|
||||||
|
|
||||||
|
// Update properties for the File object
|
||||||
|
createFile(webprojref, sandboxref, WEBAPP_ROOT, "/", ROOT_FILE);
|
||||||
|
updatePropertiesAndAssert(webprojref, sandboxref, ROOT_FILE, ("Renamed_" + ROOT_FILE));
|
||||||
|
|
||||||
|
// Update properties for the Folder object
|
||||||
|
createFolder(webprojref, sandboxref, WEBAPP_ROOT, "/", WEBAPP_GREEN);
|
||||||
|
updatePropertiesAndAssert(webprojref, sandboxref, WEBAPP_GREEN, ("Renamed_" + WEBAPP_GREEN));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updatePropertiesAndAssert(String webprojref, String sandboxref, String oldName, String updatedName) throws JSONException, IOException,
|
||||||
|
UnsupportedEncodingException
|
||||||
|
{
|
||||||
|
String propertiesUrl = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets/properties/www/avm_webapps/" + WEBAPP_ROOT + "/" + oldName;
|
||||||
|
JSONObject properties = new JSONObject();
|
||||||
|
properties.put(ContentModel.PROP_TITLE.getLocalName(), updatedName);
|
||||||
|
properties.put(ContentModel.PROP_NAME.getLocalName(), updatedName);
|
||||||
|
JSONObject submitForm = new JSONObject();
|
||||||
|
submitForm.put(FIELD_PROPERTIES, properties);
|
||||||
|
Response response = sendRequest(new PostRequest(propertiesUrl, submitForm.toString(), "application/json"), Status.STATUS_ACCEPTED);
|
||||||
|
assertUpdatedProperties(updatedName, response);
|
||||||
|
// Check whether the updated File is allowable
|
||||||
|
String assetRequestUrl = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets/www/avm_webapps/" + WEBAPP_ROOT + "/" + updatedName;
|
||||||
|
response = sendRequest(new GetRequest(assetRequestUrl), Status.STATUS_OK);
|
||||||
|
assertUpdatedProperties(updatedName, response);
|
||||||
|
// Negative test
|
||||||
|
assetRequestUrl = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets/www/avm_webapps" + WEBAPP_ROOT + "/" + oldName;
|
||||||
|
response = sendRequest(new GetRequest(assetRequestUrl), Status.STATUS_NOT_FOUND);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertUpdatedProperties(String updatedName, Response response) throws JSONException, UnsupportedEncodingException
|
||||||
|
{
|
||||||
|
JSONObject result = new JSONObject(response.getContentAsString());
|
||||||
|
JSONObject properties = (JSONObject) result.get(FIELD_DATA);
|
||||||
|
properties = (JSONObject) properties.get(FIELD_PROPERTIES);
|
||||||
|
assertEquals(updatedName, properties.get(PROP_TITLE));
|
||||||
|
assertEquals(updatedName, properties.get(PROP_NAME));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tests updating of Content of an File Asset
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public void testGetAndUpdateAssetContent() throws Exception
|
||||||
|
{
|
||||||
|
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
|
||||||
|
String webprojref = createWebProject();
|
||||||
|
createMembership(webprojref, USER_ONE, ROLE_CONTENT_MANAGER);
|
||||||
|
String sandboxref = createSandbox(webprojref, USER_ONE);
|
||||||
|
|
||||||
|
createFile(webprojref, sandboxref, WEBAPP_ROOT, "/", ROOT_FILE);
|
||||||
|
String contentRequestUrl = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets/content/www/avm_webapps/" + WEBAPP_ROOT + "/" + ROOT_FILE;
|
||||||
|
sendRequest(new GetRequest(contentRequestUrl), Status.STATUS_INTERNAL_SERVER_ERROR);
|
||||||
|
|
||||||
|
String propertiesRequestUrl = URL_WEB_PROJECT + "/" + webprojref + URI_SANDBOXES + "/" + sandboxref + "/assets/properties/www/avm_webapps/" + WEBAPP_ROOT + "/" + ROOT_FILE;
|
||||||
|
JSONObject contentEntry = new JSONObject();
|
||||||
|
String content = TEST_CONTENT_ENTRY;
|
||||||
|
contentEntry.put(FIELD_CONTENT, content);
|
||||||
|
sendRequest(new PostRequest(propertiesRequestUrl, contentEntry.toString(), "application/json"), Status.STATUS_ACCEPTED);
|
||||||
|
|
||||||
|
Response response = sendRequest(new GetRequest(contentRequestUrl), Status.STATUS_OK);
|
||||||
|
contentEntry = new JSONObject(response.getContentAsString());
|
||||||
|
assertEquals(content, contentEntry.get(FIELD_CONTENT));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility method to create a folder
|
* Utility method to create a folder
|
||||||
* @param webprojref
|
* @param webprojref
|
||||||
|
@@ -175,7 +175,7 @@ public abstract class HierarchicalMethod extends WebDAVMethod
|
|||||||
|
|
||||||
boolean localPath = true;
|
boolean localPath = true;
|
||||||
|
|
||||||
if (url.getPort() != -1 && url.getPort() != m_request.getLocalPort())
|
if (url.getPort() != -1 && url.getPort() != m_request.getServerPort())
|
||||||
{
|
{
|
||||||
// Debug
|
// Debug
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ public abstract class HierarchicalMethod extends WebDAVMethod
|
|||||||
|
|
||||||
localPath = false;
|
localPath = false;
|
||||||
}
|
}
|
||||||
else if (url.getHost().equalsIgnoreCase( m_request.getLocalName()) == false
|
else if (url.getHost().equalsIgnoreCase( m_request.getServerName()) == false
|
||||||
&& url.getHost().equals(m_request.getLocalAddr()) == false)
|
&& url.getHost().equals(m_request.getLocalAddr()) == false)
|
||||||
{
|
{
|
||||||
// The target host may contain a domain or be specified as a numeric IP address
|
// The target host may contain a domain or be specified as a numeric IP address
|
||||||
@@ -193,7 +193,7 @@ public abstract class HierarchicalMethod extends WebDAVMethod
|
|||||||
|
|
||||||
if ( IPAddress.isNumericAddress( targetHost) == false)
|
if ( IPAddress.isNumericAddress( targetHost) == false)
|
||||||
{
|
{
|
||||||
String localHost = m_request.getLocalName();
|
String localHost = m_request.getServerName();
|
||||||
|
|
||||||
int pos = targetHost.indexOf( ".");
|
int pos = targetHost.indexOf( ".");
|
||||||
if ( pos != -1)
|
if ( pos != -1)
|
||||||
@@ -234,7 +234,7 @@ public abstract class HierarchicalMethod extends WebDAVMethod
|
|||||||
if (localPath == false && logger.isDebugEnabled())
|
if (localPath == false && logger.isDebugEnabled())
|
||||||
{
|
{
|
||||||
logger.debug("Destination path, different server name/address");
|
logger.debug("Destination path, different server name/address");
|
||||||
logger.debug(" URL host=" + url.getHost() + ", localName=" + m_request.getLocalName() + ", localAddr=" + m_request.getLocalAddr());
|
logger.debug(" URL host=" + url.getHost() + ", ServerName=" + m_request.getServerName() + ", localAddr=" + m_request.getLocalAddr());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (url.getPath().indexOf(m_request.getServletPath()) == -1)
|
else if (url.getPath().indexOf(m_request.getServletPath()) == -1)
|
||||||
|
@@ -29,6 +29,8 @@ import javax.servlet.http.HttpSession;
|
|||||||
|
|
||||||
import org.alfresco.model.ContentModel;
|
import org.alfresco.model.ContentModel;
|
||||||
import org.alfresco.repo.SessionUser;
|
import org.alfresco.repo.SessionUser;
|
||||||
|
import org.alfresco.repo.management.subsystems.ActivateableBean;
|
||||||
|
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
||||||
@@ -69,9 +71,17 @@ public abstract class BaseAuthenticationFilter
|
|||||||
/** The transaction service. */
|
/** The transaction service. */
|
||||||
protected TransactionService transactionService;
|
protected TransactionService transactionService;
|
||||||
|
|
||||||
|
/** The authentication component. */
|
||||||
|
protected AuthenticationComponent authenticationComponent;
|
||||||
|
|
||||||
|
/** The remote user mapper. */
|
||||||
|
protected RemoteUserMapper remoteUserMapper;
|
||||||
|
|
||||||
/** The configured user attribute name. */
|
/** The configured user attribute name. */
|
||||||
private String userAttributeName = AUTHENTICATION_USER;
|
private String userAttributeName = AUTHENTICATION_USER;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the authentication service.
|
* Sets the authentication service.
|
||||||
*
|
*
|
||||||
@@ -116,6 +126,28 @@ public abstract class BaseAuthenticationFilter
|
|||||||
this.transactionService = transactionService;
|
this.transactionService = transactionService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the authentication component.
|
||||||
|
*
|
||||||
|
* @param authenticationComponent
|
||||||
|
* the authentication component
|
||||||
|
*/
|
||||||
|
public void setAuthenticationComponent(AuthenticationComponent authenticationComponent)
|
||||||
|
{
|
||||||
|
this.authenticationComponent = authenticationComponent;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the remote user mapper.
|
||||||
|
*
|
||||||
|
* @param remoteUserMapper
|
||||||
|
* the remote user mapper
|
||||||
|
*/
|
||||||
|
public void setRemoteUserMapper(RemoteUserMapper remoteUserMapper)
|
||||||
|
{
|
||||||
|
this.remoteUserMapper = remoteUserMapper;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the user object that will be stored in the session.
|
* Create the user object that will be stored in the session.
|
||||||
*
|
*
|
||||||
@@ -150,6 +182,15 @@ public abstract class BaseAuthenticationFilter
|
|||||||
protected SessionUser getSessionUser(ServletContext servletContext, final HttpServletRequest httpServletRequest,
|
protected SessionUser getSessionUser(ServletContext servletContext, final HttpServletRequest httpServletRequest,
|
||||||
HttpServletResponse httpServletResponse, final boolean externalAuth)
|
HttpServletResponse httpServletResponse, final boolean externalAuth)
|
||||||
{
|
{
|
||||||
|
String userId = null;
|
||||||
|
|
||||||
|
// If the remote user mapper is configured, we may be able to map in an externally authenticated user
|
||||||
|
if (remoteUserMapper != null
|
||||||
|
&& (!(remoteUserMapper instanceof ActivateableBean) || ((ActivateableBean) remoteUserMapper).isActive()))
|
||||||
|
{
|
||||||
|
userId = remoteUserMapper.getRemoteUser(httpServletRequest);
|
||||||
|
}
|
||||||
|
|
||||||
String sessionAttrib = getUserAttributeName();
|
String sessionAttrib = getUserAttributeName();
|
||||||
HttpSession session = httpServletRequest.getSession();
|
HttpSession session = httpServletRequest.getSession();
|
||||||
SessionUser sessionUser = (SessionUser) session.getAttribute(sessionAttrib);
|
SessionUser sessionUser = (SessionUser) session.getAttribute(sessionAttrib);
|
||||||
@@ -167,6 +208,36 @@ public abstract class BaseAuthenticationFilter
|
|||||||
sessionUser = null;
|
sessionUser = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (userId != null)
|
||||||
|
{
|
||||||
|
// We have a previously-cached user with the wrong identity - replace them
|
||||||
|
if (sessionUser != null && !sessionUser.getUserName().equals(userId))
|
||||||
|
{
|
||||||
|
session.removeAttribute(sessionAttrib);
|
||||||
|
session.invalidate();
|
||||||
|
sessionUser = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sessionUser == null)
|
||||||
|
{
|
||||||
|
// If we have been authenticated by other means, just propagate through the user identity
|
||||||
|
authenticationComponent.setCurrentUser(userId);
|
||||||
|
session = httpServletRequest.getSession();
|
||||||
|
String sessionId = session.getId();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
sessionUser = createUserEnvironment(session, authenticationService.getCurrentUserName(), authenticationService.getCurrentTicket(sessionId), true);
|
||||||
|
}
|
||||||
|
catch (Throwable e)
|
||||||
|
{
|
||||||
|
if (getLogger().isDebugEnabled())
|
||||||
|
getLogger().debug("Error during ticket validation and user creation: " + e.getMessage(), e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return sessionUser;
|
return sessionUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -279,6 +350,32 @@ public abstract class BaseAuthenticationFilter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Callback to create the User environment as appropriate for a filter impl
|
||||||
|
*
|
||||||
|
* @param session
|
||||||
|
* HttpSession
|
||||||
|
* @param userName
|
||||||
|
* String
|
||||||
|
* @return SessionUser
|
||||||
|
* @throws IOException
|
||||||
|
* @throws ServletException
|
||||||
|
*/
|
||||||
|
protected SessionUser createUserEnvironment(final HttpSession session, final String userName) throws IOException,
|
||||||
|
ServletException
|
||||||
|
{
|
||||||
|
return this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
||||||
|
new RetryingTransactionHelper.RetryingTransactionCallback<SessionUser>()
|
||||||
|
{
|
||||||
|
|
||||||
|
public SessionUser execute() throws Throwable
|
||||||
|
{
|
||||||
|
authenticationComponent.setCurrentUser(userName);
|
||||||
|
return createUserEnvironment(session, userName, authenticationService.getCurrentTicket(session.getId()), true);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the logger.
|
* Return the logger.
|
||||||
*
|
*
|
||||||
|
@@ -279,7 +279,7 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica
|
|||||||
|
|
||||||
// Restart the authentication
|
// Restart the authentication
|
||||||
|
|
||||||
restartLoginChallenge(resp, req.getSession());
|
restartLoginChallenge(req, resp, req.getSession());
|
||||||
|
|
||||||
chain.doFilter(sreq, sresp);
|
chain.doFilter(sreq, sresp);
|
||||||
return;
|
return;
|
||||||
@@ -349,7 +349,7 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica
|
|||||||
|
|
||||||
// Send back a request for SPNEGO authentication
|
// Send back a request for SPNEGO authentication
|
||||||
|
|
||||||
restartLoginChallenge( resp, httpSess);
|
restartLoginChallenge(req, resp, httpSess);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -366,7 +366,7 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica
|
|||||||
|
|
||||||
// Restart the authentication
|
// Restart the authentication
|
||||||
|
|
||||||
restartLoginChallenge(resp, httpSess);
|
restartLoginChallenge(req, resp, httpSess);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -419,7 +419,7 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica
|
|||||||
{
|
{
|
||||||
// Send back a request for SPNEGO authentication
|
// Send back a request for SPNEGO authentication
|
||||||
|
|
||||||
restartLoginChallenge( resp, httpSess);
|
restartLoginChallenge(req, resp, httpSess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (AuthenticationException ex)
|
catch (AuthenticationException ex)
|
||||||
@@ -448,7 +448,7 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica
|
|||||||
|
|
||||||
// Send back a request for SPNEGO authentication
|
// Send back a request for SPNEGO authentication
|
||||||
|
|
||||||
restartLoginChallenge( resp, httpSess);
|
restartLoginChallenge(req, resp, httpSess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -578,12 +578,13 @@ public abstract class BaseKerberosAuthenticationFilter extends BaseSSOAuthentica
|
|||||||
* @param httpSess HttpSession
|
* @param httpSess HttpSession
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected void restartLoginChallenge(HttpServletResponse resp, HttpSession session) throws IOException
|
protected void restartLoginChallenge(HttpServletRequest req, HttpServletResponse resp, HttpSession session) throws IOException
|
||||||
{
|
{
|
||||||
// Force the logon to start again
|
// Force the logon to start again
|
||||||
|
|
||||||
resp.setHeader("WWW-Authenticate", "Negotiate");
|
resp.setHeader("WWW-Authenticate", "Negotiate");
|
||||||
resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||||
|
writeLoginPageLink(req, resp);
|
||||||
|
|
||||||
resp.flushBuffer();
|
resp.flushBuffer();
|
||||||
}
|
}
|
||||||
|
@@ -214,7 +214,7 @@ public abstract class BaseNTLMAuthenticationFilter extends BaseSSOAuthentication
|
|||||||
|
|
||||||
// Restart the authentication
|
// Restart the authentication
|
||||||
|
|
||||||
restartLoginChallenge(resp, req.getSession());
|
restartLoginChallenge(req, resp, req.getSession());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -263,7 +263,7 @@ public abstract class BaseNTLMAuthenticationFilter extends BaseSSOAuthentication
|
|||||||
if ( hasLoginPage())
|
if ( hasLoginPage())
|
||||||
redirectToLoginPage(req, resp);
|
redirectToLoginPage(req, resp);
|
||||||
else
|
else
|
||||||
restartLoginChallenge(resp, httpSess);
|
restartLoginChallenge(req, resp, httpSess);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -293,7 +293,7 @@ public abstract class BaseNTLMAuthenticationFilter extends BaseSSOAuthentication
|
|||||||
req.getRemoteAddr() + ":" + req.getRemotePort() + ") SID:" + req.getSession().getId());
|
req.getRemoteAddr() + ":" + req.getRemotePort() + ") SID:" + req.getSession().getId());
|
||||||
|
|
||||||
// Send back a request for NTLM authentication
|
// Send back a request for NTLM authentication
|
||||||
restartLoginChallenge(resp, httpSess);
|
restartLoginChallenge(req, resp, httpSess);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -639,7 +639,7 @@ public abstract class BaseNTLMAuthenticationFilter extends BaseSSOAuthentication
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
restartLoginChallenge(res, session);
|
restartLoginChallenge(req, res, session);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1005,7 +1005,7 @@ public abstract class BaseNTLMAuthenticationFilter extends BaseSSOAuthentication
|
|||||||
* @param httpSess
|
* @param httpSess
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
protected void restartLoginChallenge(HttpServletResponse res, HttpSession session) throws IOException
|
protected void restartLoginChallenge(HttpServletRequest req, HttpServletResponse res, HttpSession session) throws IOException
|
||||||
{
|
{
|
||||||
// Remove any existing session and NTLM details from the session
|
// Remove any existing session and NTLM details from the session
|
||||||
session.removeAttribute(NTLM_AUTH_SESSION);
|
session.removeAttribute(NTLM_AUTH_SESSION);
|
||||||
@@ -1014,6 +1014,7 @@ public abstract class BaseNTLMAuthenticationFilter extends BaseSSOAuthentication
|
|||||||
// Force the logon to start again
|
// Force the logon to start again
|
||||||
res.setHeader(WWW_AUTHENTICATE, AUTH_NTLM);
|
res.setHeader(WWW_AUTHENTICATE, AUTH_NTLM);
|
||||||
res.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
res.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
|
||||||
|
writeLoginPageLink(req, res);
|
||||||
res.flushBuffer();
|
res.flushBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
package org.alfresco.repo.webdav.auth;
|
package org.alfresco.repo.webdav.auth;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
import java.net.UnknownHostException;
|
import java.net.UnknownHostException;
|
||||||
|
|
||||||
@@ -37,9 +38,7 @@ import org.alfresco.jlan.server.config.SecurityConfigSection;
|
|||||||
import org.alfresco.jlan.util.IPAddress;
|
import org.alfresco.jlan.util.IPAddress;
|
||||||
import org.alfresco.repo.SessionUser;
|
import org.alfresco.repo.SessionUser;
|
||||||
import org.alfresco.repo.management.subsystems.ActivateableBean;
|
import org.alfresco.repo.management.subsystems.ActivateableBean;
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationComponent;
|
|
||||||
import org.alfresco.repo.security.authentication.AuthenticationException;
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
||||||
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
|
||||||
import org.alfresco.repo.web.filter.beans.DependencyInjectedFilter;
|
import org.alfresco.repo.web.filter.beans.DependencyInjectedFilter;
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
import org.springframework.beans.factory.InitializingBean;
|
||||||
|
|
||||||
@@ -65,7 +64,6 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
|
|||||||
|
|
||||||
// Various services required by NTLM authenticator
|
// Various services required by NTLM authenticator
|
||||||
|
|
||||||
protected AuthenticationComponent authenticationComponent;
|
|
||||||
private String m_loginPage;
|
private String m_loginPage;
|
||||||
|
|
||||||
// Indicate whether ticket based logons are supported
|
// Indicate whether ticket based logons are supported
|
||||||
@@ -87,13 +85,6 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
|
|||||||
this.serverConfiguration = serverConfiguration;
|
this.serverConfiguration = serverConfiguration;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param authenticationComponent the authenticationComponent to set
|
|
||||||
*/
|
|
||||||
public void setAuthenticationComponent(AuthenticationComponent authenticationComponent)
|
|
||||||
{
|
|
||||||
this.authenticationComponent = authenticationComponent;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Activates or deactivates the bean
|
* Activates or deactivates the bean
|
||||||
@@ -136,31 +127,6 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Callback to create the User environment as appropriate for a filter impl
|
|
||||||
*
|
|
||||||
* @param session
|
|
||||||
* HttpSession
|
|
||||||
* @param userName
|
|
||||||
* String
|
|
||||||
* @return SessionUser
|
|
||||||
* @throws IOException
|
|
||||||
* @throws ServletException
|
|
||||||
*/
|
|
||||||
protected SessionUser createUserEnvironment(final HttpSession session, final String userName) throws IOException,
|
|
||||||
ServletException
|
|
||||||
{
|
|
||||||
return this.transactionService.getRetryingTransactionHelper().doInTransaction(
|
|
||||||
new RetryingTransactionHelper.RetryingTransactionCallback<SessionUser>()
|
|
||||||
{
|
|
||||||
|
|
||||||
public SessionUser execute() throws Throwable
|
|
||||||
{
|
|
||||||
authenticationComponent.setCurrentUser(userName);
|
|
||||||
return createUserEnvironment(session, userName, authenticationService.getCurrentTicket(session.getId()), true);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -517,4 +483,32 @@ public abstract class BaseSSOAuthenticationFilter extends BaseAuthenticationFilt
|
|||||||
{
|
{
|
||||||
return serverConfiguration == null ? null : (SecurityConfigSection) serverConfiguration.getConfigSection(SecurityConfigSection.SectionName);
|
return serverConfiguration == null ? null : (SecurityConfigSection) serverConfiguration.getConfigSection(SecurityConfigSection.SectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Writes link to login page and refresh tag which cause user
|
||||||
|
* to be redirected to the login page.
|
||||||
|
*
|
||||||
|
* @param resp HttpServletResponse
|
||||||
|
* @param httpSess HttpSession
|
||||||
|
* @throws IOException
|
||||||
|
*/
|
||||||
|
protected void writeLoginPageLink(HttpServletRequest req, HttpServletResponse resp) throws IOException
|
||||||
|
{
|
||||||
|
if ( hasLoginPage())
|
||||||
|
{
|
||||||
|
final PrintWriter out = resp.getWriter();
|
||||||
|
out.println("<html><head>");
|
||||||
|
out.println("<meta http-equiv=\"Refresh\" content=\"0; url=" +
|
||||||
|
req.getContextPath() + "/faces" + getLoginPage() +
|
||||||
|
"\">");
|
||||||
|
out.println("</head><body><p>Please <a href=\"" +
|
||||||
|
req.getContextPath() + "/faces" + getLoginPage() +
|
||||||
|
"\">log in</a>.</p>");
|
||||||
|
out.println("</body></html>");
|
||||||
|
out.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -67,7 +67,7 @@ public class KerberosAuthenticationFilter extends BaseKerberosAuthenticationFilt
|
|||||||
{
|
{
|
||||||
// Restart the login challenge process if validation fails
|
// Restart the login challenge process if validation fails
|
||||||
|
|
||||||
restartLoginChallenge(res, session);
|
restartLoginChallenge(req, res, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@@ -62,7 +62,7 @@ public class NTLMAuthenticationFilter extends BaseNTLMAuthenticationFilter
|
|||||||
{
|
{
|
||||||
// Restart the login challenge process if validation fails
|
// Restart the login challenge process if validation fails
|
||||||
|
|
||||||
restartLoginChallenge(res, session);
|
restartLoginChallenge(req, res, session);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
@@ -0,0 +1,38 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2005-2010 Alfresco Software Limited.
|
||||||
|
*
|
||||||
|
* This file is part of Alfresco
|
||||||
|
*
|
||||||
|
* Alfresco is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Lesser General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* Alfresco is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU Lesser General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.alfresco.repo.webdav.auth;
|
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An interface for objects capable of extracting an externally authenticated user ID from an HTTP request.
|
||||||
|
*
|
||||||
|
* @author dward
|
||||||
|
*/
|
||||||
|
public interface RemoteUserMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Gets an externally authenticated user ID from an HTTP request.
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* the request
|
||||||
|
* @return the user ID or <code>null</code> if the user is unauthenticated
|
||||||
|
*/
|
||||||
|
public String getRemoteUser(HttpServletRequest request);
|
||||||
|
}
|
@@ -19,9 +19,11 @@
|
|||||||
package org.alfresco.repo.webservice.repository;
|
package org.alfresco.repo.webservice.repository;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.alfresco.repo.security.permissions.AccessDeniedException;
|
||||||
import org.alfresco.repo.webservice.AbstractQuery;
|
import org.alfresco.repo.webservice.AbstractQuery;
|
||||||
import org.alfresco.repo.webservice.Utils;
|
import org.alfresco.repo.webservice.Utils;
|
||||||
import org.alfresco.repo.webservice.types.NamedValue;
|
import org.alfresco.repo.webservice.types.NamedValue;
|
||||||
@@ -113,10 +115,8 @@ public class AssociationQuery extends AbstractQuery<ResultSet>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int totalRows = assocRefs.size();
|
|
||||||
|
|
||||||
ResultSet results = new ResultSet();
|
ResultSet results = new ResultSet();
|
||||||
ResultSetRow[] rows = new ResultSetRow[totalRows];
|
List<ResultSetRow> rows = new ArrayList<ResultSetRow>(assocRefs.size());
|
||||||
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
NodeRef childNodeRef = null;
|
NodeRef childNodeRef = null;
|
||||||
@@ -130,42 +130,55 @@ public class AssociationQuery extends AbstractQuery<ResultSet>
|
|||||||
{
|
{
|
||||||
childNodeRef = assocRef.getTargetRef();
|
childNodeRef = assocRef.getTargetRef();
|
||||||
}
|
}
|
||||||
ResultSetRowNode rowNode = createResultSetRowNode(childNodeRef, nodeService);
|
|
||||||
|
Map<QName, Serializable> props = null;
|
||||||
// create columns for all the properties of the node
|
try
|
||||||
// get the data for the row and build up the columns structure
|
|
||||||
Map<QName, Serializable> props = nodeService.getProperties(childNodeRef);
|
|
||||||
NamedValue[] columns = new NamedValue[props.size()+2];
|
|
||||||
int col = 0;
|
|
||||||
for (QName propName : props.keySet())
|
|
||||||
{
|
{
|
||||||
columns[col] = Utils.createNamedValue(dictionaryService, propName, props.get(propName));
|
props = nodeService.getProperties(childNodeRef);
|
||||||
col++;
|
}
|
||||||
|
catch (AccessDeniedException e)
|
||||||
|
{
|
||||||
|
// user has no access to associated node
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now add the system columns containing the association details
|
if (props != null)
|
||||||
columns[col] = new NamedValue(SYS_COL_ASSOC_TYPE, Boolean.FALSE, assocRef.getTypeQName().toString(), null);
|
{
|
||||||
|
ResultSetRowNode rowNode = createResultSetRowNode(childNodeRef, nodeService);
|
||||||
// Add one more column for the node's path
|
|
||||||
col++;
|
|
||||||
columns[col] = Utils.createNamedValue(
|
|
||||||
dictionaryService,
|
|
||||||
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "path"),
|
|
||||||
nodeService.getPath(childNodeRef).toString());
|
|
||||||
|
|
||||||
ResultSetRow row = new ResultSetRow();
|
|
||||||
row.setRowIndex(index);
|
|
||||||
row.setNode(rowNode);
|
|
||||||
row.setColumns(columns);
|
|
||||||
|
|
||||||
// add the row to the overall results
|
// create columns for all the properties of the node
|
||||||
rows[index] = row;
|
// get the data for the row and build up the columns structure
|
||||||
index++;
|
NamedValue[] columns = new NamedValue[props.size()+2];
|
||||||
|
int col = 0;
|
||||||
|
for (QName propName : props.keySet())
|
||||||
|
{
|
||||||
|
columns[col] = Utils.createNamedValue(dictionaryService, propName, props.get(propName));
|
||||||
|
col++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Now add the system columns containing the association details
|
||||||
|
columns[col] = new NamedValue(SYS_COL_ASSOC_TYPE, Boolean.FALSE, assocRef.getTypeQName().toString(), null);
|
||||||
|
|
||||||
|
// Add one more column for the node's path
|
||||||
|
col++;
|
||||||
|
columns[col] = Utils.createNamedValue(
|
||||||
|
dictionaryService,
|
||||||
|
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "path"),
|
||||||
|
nodeService.getPath(childNodeRef).toString());
|
||||||
|
|
||||||
|
ResultSetRow row = new ResultSetRow();
|
||||||
|
row.setRowIndex(index);
|
||||||
|
row.setNode(rowNode);
|
||||||
|
row.setColumns(columns);
|
||||||
|
|
||||||
|
// add the row to the overall results
|
||||||
|
rows.add(row);
|
||||||
|
index++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the rows to the result set and set the total row count
|
// add the rows to the result set and set the total row count
|
||||||
results.setRows(rows);
|
results.setRows(rows.toArray(new ResultSetRow[0]));
|
||||||
results.setTotalRowCount(totalRows);
|
results.setTotalRowCount(rows.size());
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user