What's the best way to dynamic mapping?

external_storage

#1

Hi!

I need some help/ideas....In the past when I was using OC 9x, I used to have an script (bash script) that automatizally create mount.json for me once a month. Now it's now available anymore and I need some ideias to do the same. Let me explain my scenario: I have an active directory which also servers my user files. These files/sharing are: Home folder and some groups (some users may have 2, 3, 4, etc....groups). In the past, my owncloud VM has an SMB mount point to our AD/FileServer (root) and my bash script generate mount.json, including the home folder as home data folder in OC and for each group that user is member, a folder called '[GROUP_NAME]' was created (including '['). So, when user loged in OC, all files/folder listed in 'OC home' was the home of user in my fileserver (mapped on linux OC VM). Then, if user is in goups "A", "B" and "C", 3 folders are 'created' in his home: [A], [B] and [C].

What I would like to ask is: what is the best way to do this in latest version of OC? I don't want to manually map/create external storage for users/groups.

LDAP authentication is alredy configured (and working!). All user/groups are imported fine.


#2

Hey,

i just did the following search:

https://doc.owncloud.org/server/latest/admin_manual/search.html?q=mount+json

and stumbled over:

https://doc.owncloud.org/server/latest/admin_manual/configuration/files/external_storage_configuration.html?highlight=mount%20json

which seems to refer to some occ commands which looks to me like something you could also call from your bash script.


#3

But OC has "External Storage" web configuration, which I'm not sure, but I read somewhere that it support variables. Isn't better way to map using this?
If so, where can I find available variables in this module/app?


#4

Have you tried to see if the mentioned commands are providing some additional help output?

If there is any additional documentation available then i think it is probably available somewhere at https://doc.owncloud.org/server/latest/admin_manual


#5

Is not my intention to be rude, but if I'm asking, is because I tried.

Like I said, I'm migrating from 9.x and don't know how to use OCC. Clearly command help say something, but doesn't mean that is easy to interpret/understand.
For example: "files_external:create [--user [USER]] [-c|--config CONFIG] [--dry] [--output [OUTPUT]] [--] ". How do I use 'config'? Mounting pouint is where I would like this folder to be monuted or the origin of mounting? Can I use variables in this command (OC variables, not bash/linux)? Can I use for groups? If so, how? That's what I'm saying.

For instance, this is how I have my old mount.json configured to set user home folder to '/nero/usuarios/' + 2 'fixed' mounts.

"user":{
        "all":{
                "\/$user\/files\/[Publico]":{
                        "class":"\\OC\\Files\\Storage\\Local",
                        "options":{"datadir":"\/nero\/publico"}
                },
                "\/$user\/files\/[Temp]":{
                        "class":"\\OC\\Files\\Storage\\Local",
                        "options":{"datadir":"\/nero\/temp"}
                },
                "\/$user\/files":{
                        "class":"\\OC\\Files\\Storage\\Local",
                        "options":{"datadir":"\/nero\/usuarios\/$user"}
                }
        }
}
}

Also, I have this for groups.....this way, all groups are mounted for specific user (if they are member of this group):

 {"group":{
         "admvarejo":{
                 "\/$user\/files\/[Grupo-admvarejo]":{
                         "class":"\\OC\\Files\\Storage\\Local",
                         "options":{"datadir":"\/nero\/grupos\/admvarejo"},
                         "priority":150
                 }
         },
         "age":{
                 "\/$user\/files\/[Grupo-age]":{
                         "class":"\\OC\\Files\\Storage\\Local",
                         "options":{"datadir":"\/nero\/grupos\/age"},
                         "priority":150
                 }
         },

So my questions (2) is:
1) The web "External Storage" is the same thing of OCC 'module' called 'files_external'?
2) How do I apply this configuration (from my example, user and groups) to OCC command line?

Knowing that I can change/mod my script to use OCC or web interface to make it work.


#6

Hey, no worries as you don't sound rude. :slight_smile:

From what i know the commands are provided by this "files_external" app which is also providing the GUI. So maybe you can try to define such a mount point within the GUI and then export it with the occ export command to see how it looks like.

If the export is expected you could use your bash script to create a similar file and import it automatically with the occ import command.


#7

I haven't thought about export/import :grinning: I'll try that!

Now, the only thing that I could not find any information is about to change home of user :confused:
I know that is possible, because there is an paid app that do this.....but I need to find how.