Forum LAMS for Tech-Heads - General Forum: Re: LAMS 2.0 - Share Resources - Add Single File


 
Search: 

3: Re: LAMS 2.0 - Share Resources - Add Single File
In response to 1 02/01/07 06:55 AM
[ Reply | Forward ]
Kris,

If you are a glutton for punishment and really want to find the file then.....

One of these days, we intend to add a nice admin screen that lists all the files in the content repository. But for the moment, you have to go searching in the database tables to find out the id number of the file and then you can find it on disk.

Go into your database client and run the following SQL.

SELECT p.nv_id, p.VALUE
FROM lams_cr_workspace w,
    lams_cr_node n,
    lams_cr_node_version v,
    lams_cr_node_version_property p
WHERE w.NAME="sharedresourcesworkspace"
AND w.workspace_id = n.workspace_id
AND n.node_id = v.node_id
AND p.nv_id = v.nv_id
AND p.NAME="FILENAME"


Have a look at the output and see if you can spot the file, based on the filename.

Now take the nv_id value. The number gets split into pairs and the directory name in the content repository is based on the pairs.  So if the nv_id is 5, then look for <repository directory>/05. If the nv_id is 105, then look for <repository directory>/01/05. If the nv_id is 1105, then look for <repository directory>/11/05.

Once you have found the directory, there should be a file in it called "1". This should be the uploaded file. Copy this file to somewhere else, rename it so it has its proper extension and try opening it. It is not zipped or encrypted - just renamed to a number when it is saved on disk.

So, is the file there?

Fiona

Posted by Fiona Malikoff

5: Re: Re: LAMS 2.0 - Share Resources - Add Single File
In response to 3 02/01/07 08:50 AM
[ Reply | Forward ]
I took that challenge and made it work. The AJAX magic must be working because the files are there. I can seem them all with their generic naming system in-place. They long for an identity again.

Which database client are you using btw? Your first query wouldn't run for me. It didn't like some of the aliasing.

Anyway - thanks for this. At least we know that the upload is secretly working...

Thanks,

Kris

Posted by Kristian Besley

7: Re: Re: Re: LAMS 2.0 - Share Resources - Add Single File
In response to 5 02/01/07 05:36 PM
[ Reply | Forward ]
Which client do I use? Well, I use a number of clients, but that particular bit of code was written in DBManager (http://www.dbtools.com.br/).

Sorry about the problem with the aliases. Our scripts get run in the mysql command line client normally to make sure that they are okay with a client that everyone uses. But I just threw that code together last night and forgot to run it in mysql command line client.

Fiona

Posted by Fiona Malikoff

8: Re: Re: Re: Re: LAMS 2.0 - Share Resources - Add Single File
In response to 7 02/02/07 04:29 AM
[ Reply | Forward ]
I've tracked down the problem and it is a bug.

The problem isn't related to the group - it is related to the privileges of the user. It will only show up for a user that has only the LEARNER privilege in all groups - give the user a different role in another group and it won't happen.

I have raised the problem as https://bugs.lamsfoundation.org/browse/LDEV-1136, and it will be fixed in the LAMS 2.0.1 release.

This is the fix, should you care to do it manually. You need to be familiar with the format of Java's .jar and .war files  to try this - if you get it wrong LAMS won't start.

* Shutdown LAMS / JBOSS.
* Go to the lams.ear directory in jboss.
* Copy the lams-tool-larsrc11.war to somewhere else as a backup, in case you don't make the change correctly and need to rollback the change.
* Unzip lams-tool-larsrc11.war to a temporary directory.
* Edit the file WEB-INF\web.xml.
* Find the entry for "Download Files" and change it to this:
    <security-constraint>
          <web-resource-collection>
            <web-resource-name>Download Files</web-resource-name>
            <url-pattern>/download/</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>LEARNER</role-name>
            <role-name>AUTHOR</role-name>
            <role-name>MONITOR</role-name>
            <role-name>TEACHER</role-name>
            <role-name>ADMIN</role-name>
            <role-name>SYSADMIN</role-name>
            <role-name>AUTHOR ADMIN</role-name>
        </auth-constraint>
    </security-constraint>

You will need to add the line <role-name>LEARNER</role-name>

* Rezip up the directory, calling it lams-tool-larsrc11.war. Make sure you don't accidently get an extra folder in the lams-tool-larsrc11.war file - that will cause an error when JBOSS starts up.
* Start JBOSS/LAMS. The problem should now be fixed.

Fiona

Posted by Fiona Malikoff

10: Re: Re: Re: Re: Re: LAMS 2.0 - Share Resources - Add Single File
In response to 8 02/02/07 08:05 AM
[ Reply | Forward ]
Hi Fiona,

Okay, I did this and it now works fine. Thanks very much for the help.

I did actually mess up a couple of times trying to work out how Windows actually zips things. This caused the Share Resources tool to not work at all obviously. I had to restart LAMS a couple of times or three...

(I foolishly couldn't zip a bunch of files without putting them in a containing folder, so in the end I reverted to my Mac safety harness...)

I should have my own separate forum. I don't really belong in Tech-heads. Haha.

Cheers,

Kris

Posted by Kristian Besley

Reply to first post on this page
Back to LAMS for Tech-Heads - General Forum