OpenNebula / addon-appmarket

AppMarket builds a centralized catalog of cloud applications
http://opennebula.org/addons:addons
Apache License 2.0
10 stars 13 forks source link

AppMarket catalog filtering #1

Closed kamsz closed 10 years ago

kamsz commented 10 years ago

Allows for:

Only issue I've noticed is that catalogs are visible during registration since same form is used both for registration and editing.

kamsz commented 10 years ago

Also we've modified downloader.sh and libfs.sh to allow access restriction by using .htaccess. Since these files are in main branch, I've skipped them (provided patch works fine without these changes, but doesn't restrict users from downloading appliances directly from URL).

dmamolina commented 10 years ago

Thank you, It's a great contribution.

I have a couple of questions:

Currently, you can only define a username and password for all the Sunstone connections. Are you using the same appmarket account for all the users interacting with Sunstone?

What are the modifications you did to libfs.sh and downloader.sh? Are you using the same credentials for all the requests?

kamsz commented 10 years ago

So far I've assumed only one user and I'm using MARKETPLACE_* variables from /etc/one/sunstone-server.conf for every connection to the AppMarket.

To allow multiple users perhaps user could define his marketplace credentials somewhere in Sunstone?

downloader.sh required simple curl_args modification:

MARKETPLACE_URL=`cat /etc/one/sunstone-server.conf |grep marketplace_url |cut -d "/" -f 3`
MARKETPLACE_USERNAME=`cat /etc/one/sunstone-server.conf |grep marketplace_username |awk '{print $2}'`
MARKETPLACE_PASSWORD=`cat /etc/one/sunstone-server.conf |grep marketplace_password |awk '{print $2}'`

and in case "$FROM" in case http://_|https://_)

    if [[ $FROM =~ ^.*($MARKETPLACE_URL).*$ ]]; then
       curl_args="$curl_args -u $MARKETPLACE_USERNAME:$MARKETPLACE_PASSWORD"
    fi

libfs.sh modification was very similar, in fs_size function:

            MARKETPLACE_USERNAME=`cat /etc/one/sunstone-server.conf |grep marketplace_username |awk '{print $2}'`
            MARKETPLACE_PASSWORD=`cat /etc/one/sunstone-server.conf |grep marketplace_password |awk '{print $2}'`
            SIZE=`wget -O - -S --no-check-certificate --user $MARKETPLACE_USERNAME --password $MARKETPLACE_PASSWORD $BASE_URL 2>&1|grep -E "^ *\"size\": \"?[0-9]+\"?.$"|tr -dc 0-9`

Edit: It was more of one marketplace, many sunstones approach than many users :)

dmamolina commented 10 years ago

Thank you for your contribution. Maybe we can consider adding that support in OpenNebula for future versions.

It would be interesting to add a section in the AppMarket documentation explaining how to use this functionality and what are the limitations.

Currently, the documentation is in the doc folder of the repo, and contributions are more than welcome =) https://github.com/OpenNebula/addon-appmarket/blob/master/doc/usage.md