Hello! I’m fairly new to Ruby and Rails, and currently I don’t have any knowledge on interacting with the server’s shell or a SVN server, but now I have to develop an app where admins allow/restrict access to files and folders from the app and some sort of version control of the files is need so I thought, to install a SVN server also and from the app allow users to access files they’ve been authorized to. I’ve been searching about this but I can’t seem to find a concrete answer. Could some please tell me if this is possible and if so, point me in the right direction, what sort of stuff should i look into first?
Hello! I'm fairly new to Ruby and Rails, and currently I don't have any knowledge on interacting with the server's shell or a SVN server, but now I have to develop an app where admins allow/restrict access to files and folders from the app and some sort of version control of the files is need so I thought, to install a SVN server also and from the app allow users to access files they've been authorized to. I've been searching about this but I can't seem to find a concrete answer. Could some please tell me if this is possible and if so, point me in the right direction, what sort of stuff should i look into first?
Thank you.
I built something vaguely similar to this a number of years ago, and while I didn't go down the SVN path, what I did was this:
1. User authentication with Devise, authorization with CanCan.
2. Files stored with Paperclip (in this case they were all PDF) with text scraped from each file into a keywords field on the parent model.
3. Files versioned with vestal_version, which provided forward/back in time navigation. (I did have to hack Paperclip to never delete an attachment, and to rename each attached file to include the version info.)
I'm not sure if SVN would have been a saner choice here, I did end up reinventing the wheel. The benefit for me was that everything was in one (Rails) mental model, so I didn't have to create a bridge back and forth between my user management and file management.
Hello! I'm fairly new to Ruby and Rails, and currently I don't have any
knowledge on interacting with the server's shell or a SVN server, but
now I
have to develop an app where admins allow/restrict access to files and
folders from the app and some sort of version control of the files is
need
so I thought, to install a SVN server also and from the app allow users
to
access files they've been authorized to. I've been searching about this
but
I can't seem to find a concrete answer. Could some please tell me if
this
is possible and if so, point me in the right direction, what sort of
stuff
should i look into first?
Issuing system commands is as simple as:
system svn <command>
Or when you want to capture the command's standard output into a string:
out = `svn <command>` # These are back tics
And, if you decide to use a SCM as a backed to store your files what not
choose a SCM that isn't a steaming pile of sh*t. Like git
(http://git-scm.com). Just saying...
Explaining a little further what I need is to set the permissions to determined users from the app, however, the files aren’t in the same server as the app and it should be relatively easy to the users to access the files, and the admin wants to be able to see what files and exactly what was modified by that user on that file and when, etc,etc (That’s why I thought of an SVN server or something similar) . My idea was adding the permissions to a folder via the app so, the user in whatever SVN client he has, is able to download the lastest file and modify it and at the same time, the admin would be able to view who, what and when the files were modified. The app would only keep a record filled by the user but that wouldn’t be 100% accurate due to users (because they can pretty much write whatever they want).
Explaining a little further what I need is to set the permissions to
determined users from the app, however, the files aren't in the same
server
Keeping in mind that what I'm about to say is completely off the top of
my head...
Given that your documents are stored on a separate server from the app
thing get a little more tricky. For sake of reference let's call them
"Doc Server" and "App Server".
Assuming you have enough control of the Doc Server that you could
install a service application that's probably the approach I would take.
I would hide all access to the files behind a service application with
some sort of HTTP interface. It would be REST based if I were to build
it returning JSON responses. It would also provide secured access to the
requested files. So we have JSON for the file metadata and HTTP access
to the file data.
The service app would have a multi-part form upload used to receive
incoming files from a user. The service app would need to know the name
and email of the user, the path in the local git working tree along with
the file data.
git add --all
Used to add any new (untracked) files to the git repository.
git commit --author="John Doe <john@example.com>" -m "Changing a test
file."
This would commit all change setting the commit author to "John Doe
<john@example.com>".
git log --author="John Doe <john@exmaple.com>"
This would filter the log output to just John's commits.
git log --author="John Doe <john@exmaple.com>" --name-status
This would also include a list of files changes and the status code for
the type of change.
All of this power would be available to the service application via the
Ruby system command (or back tic):