cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to save document with normal user!

fromvenky
Champ in-the-making
Champ in-the-making
Hi,

I've created shared Add-in for Office XP in VS 2005 C#, by looking at the code written by Alfresco for Office 2003 using VSTO.

Every think working fines when i login in to Add-In using Admin user, now the problem is when I login using normal user (ie new user created under alfresco - Administrator console - Manage System Users - Create User)

While trying to save Word/Excel/Powerpoint its giving me exception at the line
– code for reference

m_WordApplication.ActiveDocument.SaveAs(
                   ref file, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue,
                   ref missingValue, ref missingValue, ref missingValue, ref missingValue,
                   ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue, ref missingValue);

Error: unable to save document

I did some investigation and found that the error was becz of the DLL not trusted by Word application

Error Message found in word "m_WordApplication.ActiveDocument" object, Message is "Programmatic acces to Visual Basic Project is not trusted"

A error also thrown by at tomcat server  (FYR)


17:35:06,619 ERROR [alfresco.webdav.protocol] Internal Server Error:
org.alfresco.repo.security.permissions.AccessDeniedException: Access Denied.  Yo
u do not have the appropriate permissions to perform this operation.
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethod
Interceptor.invoke(ExceptionTranslatorMethodInterceptor.java:53)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.audit.AuditComponentImpl.auditImpl(AuditComponentIm
pl.java:256)
        at org.alfresco.repo.audit.AuditComponentImpl.audit(AuditComponentImpl.j
ava:191)
        at org.alfresco.repo.audit.AuditMethodInterceptor.invoke(AuditMethodInte
rceptor.java:69)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:176)
        at org.springframework.transaction.interceptor.TransactionInterceptor.in
voke(TransactionInterceptor.java:107)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:176)
        at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynami
cAopProxy.java:210)
        at $Proxy40.makeFolders(Unknown Source)
        at org.alfresco.repo.webdav.LockMethod.executeImpl(LockMethod.java:202)
        at org.alfresco.repo.webdav.WebDAVMethod$1.execute(WebDAVMethod.java:144
)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransacti
on(RetryingTransactionHelper.java:228)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransacti
on(RetryingTransactionHelper.java:177)
        at org.alfresco.repo.webdav.WebDAVMethod.execute(WebDAVMethod.java:152)
        at org.alfresco.repo.webdav.WebDAVServlet.service(WebDAVServlet.java:129
)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
        at org.alfresco.repo.webdav.auth.AuthenticationFilter.doFilter(Authentic
ationFilter.java:290)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:210)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:174)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:151)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:870)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:665)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:528)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:81)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:685)
        at java.lang.Thread.run(Thread.java:619)
Caused by: net.sf.acegisecurity.AccessDeniedException: Access Denied
        at org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvoca
tionProvider.decide(ACLEntryAfterInvocationProvider.java:299)
        at org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvoca
tionProvider.decide(ACLEntryAfterInvocationProvider.java:316)
        at org.alfresco.repo.security.permissions.impl.acegi.ACLEntryAfterInvoca
tionProvider.decide(ACLEntryAfterInvocationProvider.java:200)
        at net.sf.acegisecurity.afterinvocation.AfterInvocationProviderManager.d
ecide(AfterInvocationProviderManager.java:107)
        at net.sf.acegisecurity.intercept.AbstractSecurityInterceptor.afterInvoc
ation(AbstractSecurityInterceptor.java:329)
        at net.sf.acegisecurity.intercept.method.aopalliance.MethodSecurityInter
ceptor.invoke(MethodSecurityInterceptor.java:82)
        at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(
ReflectiveMethodInvocation.java:176)
        at org.alfresco.repo.security.permissions.impl.ExceptionTranslatorMethod
Interceptor.invoke(ExceptionTranslatorMethodInterceptor.java:49)
        … 33 more


—-

Here what already tried to resolve this issue, but no luck ;(

1. Tried the SetSecurity feature used in VSTO for my add-in
2. created a new code group and granted FULL TRUST using  '.NET Framework 2.0 Configuration tool'

—-

How can i grant full trust to my Add-In DLL's ie for Word/Excel/PowerPoint

Does any one have any idea how to resolve this issue?

thanks in advance, your early response highly appreciated

Regards
Venkatesh
8 REPLIES 8

mikeh
Star Contributor
Star Contributor
We've seen an authentication issue with saving a document via WebDAV.

Does the add-in save existing documents ok? i.e. is it just a problem when you come to save a brand new document into the repo?


Thanks,
Mike

fromvenky
Champ in-the-making
Champ in-the-making
Hi Mike,

Thanks for such a quick response..

As you suggested, I've tried two cases…

Case 1:

Copy/Paste the existing document from admin user repository to normal user repository

Login in to word application using normal user and opened the copied document made some changes to it and saved it! - Document saved successfully.

Case 2:

Trying to save branded new document - its giving the exception but its saving 0kb file to the repository

Open the 0kb document from the repository,
•  no original text found,
•  added some text to it and tried save it again - it still giving me the same error and storing the 0kb file to repository

Please let me know if you need any further details!

——

FYR…

I'm using "AlfrescoEnterprise-2.1.0-Setup.exe" version server

Regards
Venkatesh

mikeh
Star Contributor
Star Contributor
Yes, that appears consistent with what we've seen.

We do have a workaround, but it means opening up a potential security hole in the FileFolderService, allowing arbitrary users to create folders anywhere in the repo. I'm PM'ing you the workaround to public-service-security-context.xml to see if that corrects the problem on your system.

We have fixed this "properly" in the soon-to-be-released v2.2E (currently in closed beta testing).

Well done on developing the add-in by the way!

A few questions:
- Did you have any other issues in converting the add-in code to Office XP?
- Did you have to bugfix (or improve) any existing code brought over from the Office 2003 project?
- Do you plan to make this project (with or without source) generally available?

Finally, I've noticed a bug in PowerPoint whereby the ".ppt" extension is appended to the WebDAV URL after the ticket parameter, meaning automatic authentication won't work when saving ppts to the repo (you'll always get the login prompt). Does this bug also exist in Office XP?

Thanks,
Mike

fromvenky
Champ in-the-making
Champ in-the-making
Thanks,

During the further investigation, I found that Normal User able to save the document incase of following scenario

1. Login in Word application using Normal User
2. added some text to new document
3. click on Athenaeum button - on popup screen selected 'Browse space and documents' tab
4. Create a new space if not already exists / Select the space if already exists
5. click on 'Save to Alfresco' link, its ask for file name - provide the file name – click on  OK button
6. Document saved successfully

by this we can say that normal user able to save the document but not in the root folder ie "/Company Home/User Homes"

FYR..

the default Home space for New User I've created is "/Company Home/User Homes"



I've few questions

1. The new version to-be-released v2.2E, when can we expect to be out in final version?
2. What kind of workaround approach you have taken in 'public-service-security-context.xml' to fix this issue? - can you please share that with everyone!

Yes, there are some bugs which i found during the testing

1. Insert File option gives Error: Command failed - both for admin/normal user
2. Transform to PDF showing error on status bar of Athenaeum but able to generate the pdf file successfully

Error: Could not convert document

Suggestions

1. We can think of Log4Net for logging and debugging
2. Single sign on for three application ie Word/Excel/Powerpoint!


Regards
Venkatesh Balingula

mikeh
Star Contributor
Star Contributor
Sorry - I missed your update to this post

1. The new version to-be-released v2.2E, when can we expect to be out in final version?
That depends on the outcome of the private beta testing. I'd expect a few weeks or so, but that's just a guess.

2. What kind of workaround approach you have taken in 'public-service-security-context.xml' to fix this issue? - can you please share that with everyone!
I sent it to you via PM on this forum - looks like you received it ok. We're not prepared to share the workaround widely because it opens up a security hole. We're planning a proper fix in the meantime.

1. Insert File option gives Error: Command failed - both for admin/normal user
Is that just with Office XP? This function works well with Office 2003 and 2007.

2. Transform to PDF showing error on status bar of Athenaeum but able to generate the pdf file successfully

Error: Could not convert document
Not sure what that's about - what does the Alfresco log file contain when that error appears?

Suggestions

1. We can think of Log4Net for logging and debugging
2. Single sign on for three application ie Word/Excel/Powerpoint!
Thanks for the suggestions. Regarding the single sign-on: if you choose to save the authentication details, these same values are used across all three add-ins.

Thanks,
Mike

fromvenky
Champ in-the-making
Champ in-the-making
Hi MikeH,

Thanks for your PM, I applied the patch its working fine ie Normal user able to save the document.

Regarding the two new issues which I mentioned in earlier post!

1. Transform to PDF / Make PDF option in Alfresco web client

I Search this issue in Alfresco Forum and found that to convert an Document to pdf is required install OpenOffice.

link FYR.. http://forums.alfresco.com/viewtopic.php?t=9545&highlight=transformdocument

after installing the OpenOffice this issue was resolved

2. Insert file into current Document

We have an option in web client by which we can copy the content of the document (ie saved already in alfresco repository) into the new document

here the code, FYR…

m_WordApplication.Selection.InsertFile(strFullPath, ref missingValue, ref trueValue, ref missingValue, ref missingValue);

I tried this feature in Office XP(2002) and also in Office 2003 its not working when ever i'm clicking this option i'm getting an exception

Error: Error while addOLEObject

When i tried this option through Word–Insert menu – File
copied and paste the url from log into open dialog box its first asks for username and password then it taken me to the network folder where file present, upon file selection click on ok its working fine ie inserted the contents of the document into current position


Sorry, but one more new issue i got today

1. Compare with Current (this option available under View Details tab) after document being versionable

upon using this option its throwing runtime error, here error track trace

Error track trace taken from log (log4net) used in this project for logging the messages…

comparingDocument, relativeURL:/d/d/versionStore/lightWeightVersionStore/805b1350-e3aa-11dc-b878-851ba36f5123/NewTest.doc
- Document Path: http://localhost:8080/alfresco/d/d/versionStore/lightWeightVersionStore/805b1350-e3aa-11dc-b878-851b...
- Error while compareDocument, Error: The document name or path is not valid.
Try one or more of the following:
* Check the path to make sure it was typed correctly.
* On the File menu, click Open. Search for the file using this dialog box.
(http://localhost:8080/.../NewTest.doc)

Please let me know your thoughts on this!


Regards
Venkatesh

P.S: there is no error on server

fromvenky
Champ in-the-making
Champ in-the-making
Hi MikeH,

did you got chance to look at my previous post?

Thanks in advance

waiting for your positive reply

Regards
Venkatesh

mikeh
Star Contributor
Star Contributor
Both problems seem to stem from authentication issues.

The Office APIs simply don't support asking the user for authentication, so they need to either be run over a previously-authenticated channel (within the Office application itself) or with an Alfresco ticket parameter on the URL.

Having said that, I've not seen any issue with the "Insert File" function with Office 2003.

What exactly is the URL in both cases?

Thanks,
Mike