Table contents
- eyeOS 2.5 installation on Ubuntu
- Persistence
- Implementation of StackSync API into eyeOS
- Implementation of Share API into eyeOS
-
Apache HTTP Server
# apt-get install apache2
# apache2 -versionType in the navegation bar of the browser http://localhost, and you'll see apache2 page (It works!)
-
Mysql
# apt-get install mysql-server mysql-client
# mysql --versionRemember the password of database's administrator ('root'), because it'll be requested during the eyeOS 2.5 installation.
-
Php
# apt-get install php5 php5-mysql libapache2-mod-php5 php5-gd php5-mcrypt php5-sqlite php-db php5-curl php-pear php5-dev
# php5 --versionConfigure the php.ini.
# cd /etc/php5/apache2/
# nano php.iniChange the next parameters:
-
Java
# apt-get install python-software-properties
# add-apt-repository ppa:webupd8team/java
# apt-get update
# apt-get install oracle-java7-installer
# update-alternatives --config java
# java -version -
OpenOffice
# apt-get install openoffice.org
-
Python
# apt-get install python-support python-simplejson python-uno recoll zip unzip libimage-exiftool-perl
# pip install requests requests_oauthlib -
Curl SSL
If you don't have SSL certificate get it by typing:
# wget http://curl.haxx.se/ca/cacert.pemOpen the php.ini and introduce the path where the certificate to make requests to secure url is located.
# cd /etc/php5/apache2/
# nano php.ini
....
curl.cainfo='/root/cacert.pem' -
Uploadprogress
# apt-get install make
# pecl install uploadprogress# nano /etc/php5/apache2/php.ini (Add the last two lines) .
-
Sendmail
# apt-get install sendmail
# nano /etc/hosts (Add localhost.localdomain to IP 127.0.0.1)# sendmailconfig (Confirmar todas las preguntas)
-
Apache
Configure mod-rewrite in apache:
# a2enmod rewrite
# nano /etc/apache2/sites-available/default
Change into <Directory /var/www/> the parameter AllowOverride to All
Restart the apache service
# /etc/init.d/apache2 restart
Download the code into /var/www
# cd /var/www/
# git clone https://github.com/cloudspaces/eyeos-u1db eyeos
Change the eyeos directory's permissions
# chown -R www-data.www-data eyeos
# chmod -R 755 eyeos
Add to DocumentRoot the eyeos directory:
# nano /etc/apache2/sites-available/default
# service apache2 restart
Install python-u1db package:
# cd eyeos/eyeos/packages/
# dpkg -i python-u1db_0.1.4-0ubuntu1_all.deb
If you have dependency problems during package installation follow the next steps:
# apt-get install python-u1db
# apt-get -f install
# dpkg -i python-u1db_0.1.4-0ubuntu1_all.deb
Get into mysql and create the schema 'eyeos'. As showed bellow:
# mysql -uroot -p<password>
> create database eyeos;
Open into the browser the eyeOS configuration screen (http://localhost/install)
Select 'Install eyeOS 2 on my server'
The error "SQLite extension not installed" can be ignored.
Once all requirements are listed, go on with the installation selecting 'Continue with the installation'.
Introduce user and password of mysql database's administrator (root), and in addition, the eyeOS platform root user's password.
Once configured the database and eyeOS user, go on with the installation selecting 'Continue with the installation'.
After the installation is finished select 'Go to my new eyeOS' to see the eyeOS 2.5 platform's login screen.
The url of StackSync resources requests can be configured in the file settings.php
# cd /var/www/eyeos/
# nano settings.php
Follow the steps explained in the Readme.md file, located in /var/www/eyeos/serverU1DB. The serverU1DB can be installed in the same machine than eyeOS or in another independent machine.
If installed in another independent machine the directories /var/www/eyeos/serverU1DB and /var/www/eyeos/eyeos/package must be copied in that machine.
eyeOS Calendar and the comments tool of the file manager store data in a U1DB database.
U1DB is a database API to sync JSON documents that was created by Canonical. It lets applications store documents and synchronize them between machines and devices. U1DB is designed to work anywhere, acting as a storage backup for native platform data. This means it can be implemented on any platform, from different languages, providing backup and sync services between platforms.
The U1DB API contains three sections: document storage/retrieval, querying and synchronization. A short description of their operation is given below.
U1DB stores documents, basically any information that can be expressed in JSON.
created_doc_from_json(json,doc_id=None)
Creates a document from JSON data.
Optionally the doc id can be specified. This id must not exist in the database. If the database specifies a maximum document size and the document exceeds this size, a DocumentTooBig exception is triggered.
Parameters: |
|
Return: | Document |
put_doc(doc)
Updates documents. If the database specifies a maximum document size and the document exceeds this size, a DocumentTooBig exception is triggered.
Parameters: | doc – Document with new contents |
Return: | new_doc_rev - New revision id for the document. The document object will also be updated |
set_json(json)
Updates document's JSON data.
Parameters: | json – JSON data |
delete_doc(doc)
Flags a document as deleted.
Parameters: | doc – Document to delete |
Querying in U1DB is done using indexes. To retrieve certain documents from the database according to specific criteria, first you must create an index and then query this index.
create_index(index_name,*index_expressions)
Creates an index that will be used to perform queries in the database. No exceptions are triggered if you try to create an existing index. However, an exception is triggered if you try to create an index that changes the index_expressions of a previously created index.
Parameters: |
Examples: “nameKey” o “nameKey.nameSubKey” |
get_from_index(index_name,*key_values)
Returns the documents containing the keys specified. The same number of values as keys defined in the index must be specified.
Parameters: |
|
Return: | List of documents |
U1DB is a syncable database. Any U1DB database can be synced with a U1DB server. Most U1DB installations can be run as server.
Syncing the server and the client updates both sides so that they contain the same data. Data is saved in local U1DBs, whether online-offline, and then synchronized when online.
sync(url,creds=None,autocreate=True)
Syncs documents with a remote replica via a URL.
Parameters: |
|
Return: | local_gen_before_sync – A local gen key to control synchronization. This is useful with the whats_changed function, if an application needs to know the documents changed during synchronization. |
To sync eyeOS Calendar and the comments tool applications, authentication must be done with the server using the OAuth protocol.
The OAuth server provides access to a unique protected resource, the U1DB server.
The eyeOS platform implements the Credentials.py script, which contains the APIs required for communicating with the OAuth server.
The communication dialog is as follows:
Step 1:
API getRequestToken() gets the consumer key and consumer secret from the settings (see Annex 1.2). It then makes a call to the OAuth server using the “request_token” URL.
The OAuth server retrieves the consumer key from the database and compares it with the consumer key received. If the keys do not match, it returns an error; otherwise, it performs a new search in the database using the consumer key to get the request token.
The OAuth server responds to the eyeOS call, returning the request token and access verifier to request the access token.
The eyeOS platform stores the request token and the verifier in the session variables so that it does not have to repeat the process in subsequent steps.
Step 2:
API getAccesToken(token,verifier) makes a call to the OAuth server through the “access_token” URL.
The OAuth server retrieves the consumer key and request token from the database and compares them with those received from getAccessToken(). If they do not match, it returns an error; otherwise, it performs a new search in the database with the consumer key and request token to get the access token. If no data is obtained or the data obtained has expired, a new access token must be generated and stored in the database, which means that previous tokens will no longer have access.
The OAuth server responds to the eyeOS call, returning the access token.
Step 3:
API protocol(params) calls the OAuth server via the U1DB synchronization API.
The OAuth server retrieves the access token from the database using the consumer and token received. If they do not match, it returns an error; otherwise, it syncs with the U1DB server.
Step 1 only applies where a request token has not been requested during the eyeOS user session.
Authentication implemented in both applications is requested for each resource request. The request process flow is illustrated in the following diagram:
Persistence OAuth Manager and Persistence OAuth API persistence functions are described in more detail, respectively:
Persistence OAuth Manager
callProcessCredentials()
Gets credentials of the eyeOS consumer.
Script call: | No parameters |
Return: |
Token object or in the event of error null Example: { "oauth":{ "token_key":"access1234", "token_secret":"access_secret", "consumer_key":"key1234", "consumer_secret":"secret1234", } } |
Persistence OAuth API
The configuration file of OAuth API is found at “/var/www/eyeos/eyeos/extern/u1db/” and is called “settings.py”. This file must be modified in the following values:
Server | IP address where the Oauth server is active |
Port | Port where the Oauth server is active |
urls | |
CALLBACK_URL | Replace IP and port with the values stablished in the previous parameters (server and port) |
consumer | |
key | Included when mongodb was configured in the Oauth server installation |
secret | Included when mongodb was configured in the Oauth server installation |
getRequestToken()
Gets the request token of the eyeOS consumer.
Url: | Use REQUEST_TOKEN_URL of the configuration file. |
Method: | GET |
Signature: | Plaintext |
Parameters: | No parameters |
Return: |
Key and secret of the request token or, in the event of error, returns an error structure: - error: Error number - description: Error description Example: {“oauth_token” : “token1234”, “oauth_secret” : “secret1234”} {“error” : “401”, “description” : “Authorization required”} |
getAccessToken(token,verifier)
Gets the access token of the eyeOS consumer from the request token and verifier received.
Url: | Use ACCESS_TOKEN_URL of the configuration file. |
Method: | GET |
Signature: | Plaintext |
Parameters: |
token – OauthToken object. Includes key and secret values of the request token verifier – Word by which the user is authenticated |
Return: |
Key and secret of the access token or, in the event of error, returns an error structure: - error: Error number - description: Error description Example: { "credentials":{ "token_key":"access1234", "token_secret":"access_secret", "consumer_key":"key1234", "consumer_secret":"secret1234", }, "request_token":{"key":"token1111","secret":"secret2222"}, "verifier":"verifier" } {"error" : "401", "description" : "Authorization required"} |
EyeOS storages the user's calendars and events into U1DB synchronized database.
Calendar and event sync processes are performed when eyeOS Calendar is opened.
Calendars are synced every 20 seconds. If any changes are detected, the calendar list is refreshed and the waiting time is reset.
Events are synced every 10 seconds. If any changes are detected, the events of the period shown on screen are refreshed and the waiting time is reset.
Persistence in implemented in eyeOS according to the diagram below:
The user performs an action on the calendar, such as adds an event to a specific calendar. The Manager uses the insertEvent function to retrieve the user’s credentials. These values are sent to the API together with the data of the new event. The API is responsible for requesting the resource from the U1DB server using the insertEvent function.
If everything is correct, the U1DB server updates the server database and subsequently notifies other clients of the change. The API receives confirmation of the change and applies it to the client U1DB database. Once the updates have been made, it notifies the Manager, which modifies the local calendar tables and updates the eyeOS interface.
The insertEvent functions of the Calendar Manager and the Calendar API, as well as the other actions performed by the calendar. Now are described in more detail, respectively.
Calendar Manager
The Calendar Manager API consists of a uniform structure in the script call:
Parameters: |
|
The functions are listed and described below.
synchronizeCalendars(user)
Requests credentials of the eyeOS consumer.
Parameters: | user – Contains the id and name of the eyeOS user |
Script call: |
Example: { "type":"selectCalendar" , "lista":[{ "type":"calendar", "user_eyeos": "eyeos" }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: | List of calendars |
insertCalendars(user,calendar)
Creates a new calendar.
Parameters: |
|
Script call: |
Example: { "type":"insertCalendar" , "lista":[{ "type":"calendar", "user_eyeos": "eyeos" "name": "personal" "status": "NEW" "description": "personal calendar" "timezone": 0 }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: | True or in case of error null |
deleteCalendars(user,calendar)
Deletes an existing calendar.
Parameters: |
|
Script call: |
Example: { "type":"deleteCalendar" , "lista":[{ "type":"calendar", "user_eyeos": "eyeos" "name": "personal" }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: | True or in the event of error null |
synchronizeCalendar(calendarId,user)
Synchronizes all the events of the specified calendar of the user connected to the eyeOS platform.
Parameters: |
|
Script call: |
Example: { "type":"selectEvent" , "lista":[{ "type":"event", "user_eyeos": "eyeos" "name": "personal" }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: | List of events |
createEvent(event)
Creates a new event
Parameters: | event – Contains the U1DB structure of the event |
Script call: |
Example: { "type":"insertEvent" , "lista":[{ "type":"event", "user_eyeos": "eyeos" "calendar": "personal" "status": "NEW" "isallday": "0" "timestart": "201419160000" "timeend": "201419170000" "repetition": "None" "finaltype": "1" "finalvalue": "0" "subject": "Visita Médico" "location": "Barcelona" "description": "Llevar justificante" }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: | True or in the event of error null |
deleteEvent(event)
Deletes an existing event.
Parameters: | event – Contains the U1DB structure of the event |
Script call: |
Example: { "type":"deleteEvent" , "lista":[{ "type":"event", "user_eyeos": "eyeos" "calendar": "personal" "status": "DELETED" "isallday": "0" "timestart": "201419160000" "timeend": "201419170000" "repetition": "None" "finaltype": "1" "finalvalue": "0" "subject": "Visita Médico" "location": "Barcelona" "description": "Llevar justificante" }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: | True or in the event of error null |
updateEvent(event)
Updates an existing event.
Parameters: | event – Contains the U1DB structure of the event |
Script call: |
Example: { "type":"updateEvent" , "lista":[{ "type":"event", "user_eyeos": "eyeos" "calendar": "personal" "status": "CHANGED" "isallday": "0" "timestart": "201419160000" "timeend": "201419170000" "repetition": "None" "finaltype": "1" "finalvalue": "0" "subject": "Visita Médico" "location": "Barcelona" "description": "Llevar justificante" }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: | True or in the event of error null |
Calendar API
To display the calendars correctly in the eyeOS platform, the structure of the calendars and the events, as well as their indexes, must be respected:
- calendar: type and user_eyeos.
- events: type, user_eyeos and calendar.
The functions are listed and described below.
selectCalendar(data)
Get all calendars of the user.
Parameters: | data – Contains the type and the user. Example: {“type”:”calendar”,”user_eyeos”:”eyeos”} |
Return: | Vector with all the calendars, in JSON format Example: [{ “type”:”calendar”, ”user_eyeos”:”eyeos”, ”name”:”personal”, ”description”:”personal calendar”, ”timezone”: 0, ”status”:”NEW” }] |
insertCalendar(lista)
Inserts the new calendar generated by the user in eyeOS.
Parameters: | lista – Contains a vector of the calendars to be inserted. Example: [{ “type”:”calendar”, ”user_eyeos”:”eyeos”, ”name”:”personal”, ”description”:”personal calendar”, ”timezone”:0, ”status”:”NEW” }] |
Return: | 'true' or exception in the event of error |
deleteCalendar(lista)
Identifies the status of the calendar to be deleted (STATUS=”DELETED”) of a specific eyeOS user.
Parameters: | lista – Contains a vector of the calendars to be deleted. Example: [{ “type”:”calendar”, ”user_eyeos”:”eyeos”, ”name”:”personal” }] |
Return: | 'true' or exception in the event of error |
selectEvent(type,user,calendarId)
Gets all the events of the calendar belonging to the specified user.
Parameters: |
|
Return: |
Vector with all the calendar events, in JSON format Example: [{ “type”:”event”, ”user_eyeos”:”eyeos”, ”calendar”:”personal”, ”status”:”NEW”, “isallday”: “0”, “timestart”: “201419160000”, “timeend”:”201419170000”, “repetition”: “None”, “finaltype”: “1”, “finalvalue”: “0”, “subject”: “Visita Médico”, “location”: “Barcelona”, “description”: “Llevar justificante” }] |
insertEvent(lista)
Inserts a new event in the calendar of the specified user.
Parameters: |
lista – Contains a vector of the events to be inserted. Example: [{ “type”:”event”, ”user_eyeos”:”eyeos”, ”calendar”:”personal”, ”status”:”NEW”, “isallday”: “0”, “timestart”: “201419160000”, “timeend”:”201419170000”, “repetition”: “None”, “finaltype”: “1”, “finalvalue”: “0”, “subject”: “Visita Médico”, “location”: “Barcelona”, “description”: “Llevar justificante” }] |
Return: | 'true' or exception in the event of error |
deleteEvent(lista)
Identifies the status of the event of a calendar to be deleted for a specific eyeOS user.
Parameters: |
lista – Contains an array with the events identified as deleted. Example: [{ “type”:”event”, ”user_eyeos”:”eyeos”, ”calendar”:”personal”, ”status”:DELETED, “isallday”: “0”, “timestart”: “201419160000”, “timeend”:”201419170000”, “repetition”: “None”, “finaltype”: “1”, “finalvalue”: “0”, “subject”: “Visita Médico”, “location”: “Barcelona”, “description”: “Llevar justificante” }] |
Return: | 'true' or exception in the event of error |
updateEvent(lista)
Changes the data of an event in the existing calendar of a specific eyeOS user.
Parameters: |
lista – Contains a vector of the events to be updated. Example: [{ “type”:”event”, ”user_eyeos”:”eyeos”, ”calendar”:”personal”, ”status”:CHANGED, “isallday”: “0”, “timestart”: “201419160000”, “timeend”:”201419170000”, “repetition”: “None”, “finaltype”: “1”, “finalvalue”: “0”, “subject”: “Examen”, “location”: “Tarragona”, “description”: “Llevar libro” }] |
Return: | 'true' or exception in the event of error |
The comments tool is only valid in the user’s Personal Cloud because it is a collaboration resource between StackSync and eyeOS.
The user accesses the comments tool when they select a Personal Cloud file or directory in the file manager and then clicks the “Comments” tab in the right toolbar (social bar).
The comments tool lists all comments inserted for a specific element, both those from the element’s owner and from other users who have been given privileges to access the element.
The data given in a list comment is:
- name of the user who made the comment
- creation date/time
- text entered
Example:
User | stacksync2 |
Date / time | 04/07/2014 13:02 |
Text | Welcome 3 |
Other actions that can be performed include insert new comments with the “New” option or delete existing comments with the “Delete” option. The delete option is restricted; only comments made by the user in question can be deleted. Users cannot delete comments made by others.
The comments list is not refreshed, as there is no background process that enables new comments to be displayed automatically.
Persistence is implemented in the eyeOS comments tool according to the diagram below:
The user performs an action, such as inserts a new comment in the list. The Manager using the createComment function retrieves the user’s credentials. These values are sent to the API together with the data of the new comment. The API is responsible for requesting the resource from the U1DB server using the createComment function.
If everything is correct, the U1DB server updates the server database and subsequently notifies other clients of the change. The API receives confirmation of the change and applies it to the client U1DB database. Once the updates have been made, it notifies the Manager, which will update the eyeOS interface.
The createComment functions of the Comment Manager and the Comment API, as well as the other actions performed by the comments tool. Now are described in more detail, respectively:
Comment Manager
The Comment Manager API consists of a uniform structure in the script call:
Parameters: |
|
The functions are listed and described below.
getComments(id)
Gets all the comments of a StackSync element.
Parameters: | id – Id of the StackSync element |
Script call: |
Example: { "type":"get" , "metadata":[{ "id":"124578", }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: |
Array containing all comments, in JSON format or, in the event of error, returns an error structure: - error: Error number Example: [{ “id”:”1245789”, ”user”:”eyeos”, ”time_created”:”20140702124055”, ”status”:”NEW”, ”text”: ”Comment 1” }] [{“error”:-1,”description”:”Error getComments”}] |
createComment(id,user,text)
Links a new comment to a specific StackSync element.
Parameters: |
id – Id of the StackSync element user – Name of the user inserting a comment text – Text of the comment |
Script call: |
Example: { "type":"create" , "metadata":[{ "id":"124578", "user":"eyeos", "text":"Comment 1", }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: |
Metadata of the comment, in JSON format or, in the event of error, returns an error structure: - error: Error number - description: Error description Example: [{ “id”:”1245789”, ”user”:”eyeos”, ”time_created”:”20140702124944”, ”status”:”NEW”, ”text”: ”Comment 1” }] {“error”:-1,”description”:”Error create comment”} |
deleteComments(id,user,time_created)
Deletes a comment of a specific StackSync element.
Parameters: |
id – Id of the StackSync element user – Name of the user inserting a comment time_created – Date and time when the comment was created. YYYYmmddHHMMSS format |
Script call: |
Example: { "type":"delete" , "metadata":[{ "id":"124578", "user":"eyeos", "time_created":"20140702124944", }] "credentials":{ ”oauth”:{ “consumer_key”:”eyeos”, “consumer_secret”:”eyeosABC”, “token_key”:”eyeostoken”, “token_secret”:”eyeosDEF” } } } |
Return: |
Result structure: - status: 'OK' if correct or 'KO' in the event of error - error: Error number. Only exists in the event of error Example: {“status”: “OK”} { “status”: “KO”, “error”: -1 } |
Comment API
getComments(id)
Gets all comments of a specific StackSync element.
Parameters: | id – Id of the StackSync element |
Return: | Vector containing all comments, in JSON format or, in the event of error, returns an error structure: - error: Error number - description: Error description Example: [{ “id”:”1245789”, ”user”:”eyeos”, ”time_created”:”20140702124944”, ”status”:”NEW”, ”text”: ”Comment 1” }] [{“error”:-1,”description”:”Error getComments”}] |
createComment(id,user,text,time_created)
Links a new comment to a specific StackSync element.
Parameters: |
id – Id of the StackSync element user – Name of the user inserting a comment text – Text of the comment time_created – Date and time when the comment was created. YYYYmmddHHMMSS format (Optional) |
Return: | Metadata of the comment, in JSON format or, in the event of error, returns an error structure: - error: Error number - description: Error description Example: [{ “id”:”1245789”, ”user”:”eyeos”, ”time_created”:”20140702124055”, ”status”:”NEW”, ”text”: ”Comment 1” }] {“error”:-1,”description”:”Error create comment”} |
deleteComment(id,user,time_created)
Deletes a comment from a specific StackSync element.
Parameters: |
id – Id of the StackSync element user – Name of the user inserting a comment time_created – Date and time when the comment was created. YYYYmmddHHMMSS format (Optional) |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Return: | Result structure: - status: 'OK' if correct or 'KO' in the event of error - error: Error number. Only exists in the event of error Example: {“status”: “OK”} { “status”: “KO”, “error”: -1 }
Within the eyeOS Personal Web Desktop, one of the key features of the platform is file management. eyeOS includes a web file manager developed in JavaScript, HTML and CSS that enables users to manage all their files directly from their browser, but with an experience similar to a file manager of any desktop operating system, such as Microsoft Windows™ or GNU/Linux. By integrating Personal Cloud services in the eyeOS platform, users can use eyeOS’ web file manager and all its features with their Personal Cloud files. For example, users can display online their documents saved in their Personal Cloud, create directories, move files, share documents, etc. Users access the files in their Personal Cloud using the StackSync directory. To get the file and directory structure of Personal Cloud, a call is made to StackSync’s API. This call returns metadata with all the structural information of the files and directories, which eyeOS uses to generate a local replica. The files and directories are created without content. When the user selects an element and performs an operation on it, i.e. opens, moves or copies it, the element's contents are downloaded. By doing this, the system is not overloaded unnecessarily by retrieving information that the user will not use at that moment. If the content of a file or directory has already been retrieved and there are no changes, it will not be updated. The file manager can retrieve previous versions of a file. It shows a list of all the available versions of the file, letting the user retrieve the contents of the desired version. If the user makes changes to a previous version, when those changes are saved, a new version is created in Personal Cloud. The contents of the current directory are synced with the Personal Cloud directory in a background process, which sends queries every 10 seconds to check whether there are any changes. If there are any changes, the current structure is updated. ###Authentication The eyeOS platform uses OAuth authentication in order to interact with the user’s protected data stored in Personal Cloud. OAuth is an authorization protocol that enables the user (resource owner) to authorize eyeOS to access the resources on their behalf without giving eyeOS their authentication credentials i.e. user name and password. When the eyeOS user accesses the file manager for the first time, a newly developed plugin is used to get a security token with which the keys required for interacting with user data stored in Personal Cloud can be obtained. The Access Token and Token Secret keys are stored in the ‘token’ table of the relational database management system (RDBMS) based on MySQL. These keys are linked with the user who has logged into the platform, meaning the system can determine the access token for a given user who attempts to use the service at any stage. The communication dialog is as follows: Step 1: Request from StackSync the consumer key and secret token that identifies eyeOS as the CloudSpaces resource consumer.This communication is done via email. Step 2: Get the request token and provide StackSync with the redirect URL to eyeOS once the user grants authorization. StackSync responds to the previous request by giving a valid request token and an authorization URL. Step 3: Redirect the user to the authorization URL where the user grants eyeOS access to their private space. Once StackSync verifies the user, it redirects the user to the eyeOS URL provided in the previous step. Step 4: Get the access token and token secret from StackSync, with which eyeOS will identify itself when accessing the user’s private space in CloudSpaces. Authentication is implemented in eyeOS according to the diagram below: The OAuth Manager and OAuth API functions now are described, respectively: OAuth Manager getRequestToken() Gets the request token of the eyeOS consumer.
getAccessToken(token) Get the access token of eyeOS consumer from the request token.
OAuth API The configuration file of the OAuth API is found at “/var/www/eyeos/eyeos/extern/u1db/” and is called “settings.py”. getRequestToken(oauth) Gets the request token of the eyeOS consumer.
getAccessToken(oauth) Gets the access token of the eyeOS consumer from the request token stored.
If the user has not previously granted eyeOS access to their CloudSpaces private space, when they access the file manager, the authentication process is initiated, as shown in the following screens:
During the authentication process, various exceptions may be triggered, which interrupt the process to get the access token. These errors are described below:
To integrate the Personal Cloud storage service within eyeOS, the Storage Manager and the Storage API have been created. The Storage API communicates with the StackSync API v2, which manages all the requests made from the file manager. Storage is implemented in eyeOS according to the diagram below: The user performs an action in the file manager, such as opening a directory. The Storage Manager using the getMetadata function retrieves the user’s access token and id for the directory in StackSync. These values are sent to the API, which is responsible for requesting the resource from StackSync using the getMetadata function. The file structure of the directory is retrieved and stored in the database, and the Manager is notified of the new structure, which will update the eyeOS interface. The getMetadata functions of the Storage Manager and the Storage API, as well as the other actions performed by the file manager. Now are described in more detail, respectively: Storage Manager getMetadata(token,id,path,user) Gets metadata for the current element. Generates its file structure and/or directories in eyeOS.
getSkel(token,file,id,metadatas,path,pathAbsolute,pathEyeos) Recursively gets metadata depending on the current element. This function is used in the copy and move action in eyeOS.
createMetadata(token,user,file,name,parent_id,path,pathAbsolute) Creates a new file or directory.
downloadMetadata(token,id,path,user,isTmp=false) Downloads the content of a file.
deleteMetadata(token,file,id,user,path) Deletes an existing file or directory.
renameMetadata(token,file,id,name,path,user,parent) Renames a file or directory.
moveMetadata(token,file,id,pathOrig,pathDest,user,parent,filenameOld,filenameNew) Moves a file or directory.
listVersions(token,id,user) Gets a list of versions for a specific file.
getFileVersionData(token,id,version,path,user) Downloads the contents of a specific version of an existing file.
Storage API The configuration file of Storage API is found at“/var/www/eyeos/eyeos/extern/u1db/” and is called “settings.py”. The “Stacksync” key components of the configuration file are:
getMetadata(oauth,file,id,contents) Gets metadata of a directory and/or files.
updateMetadata(oauth,file,id,name,parent) Updates metadata of the element for rename and move actions.
createMetadata(oauth,file,name,parent,path) Creates a new element (file or directory)
uploadFile(oauth,id,path) Uploads the content of an existing file.
downloadFile(oauth,id,path) Downloads the content of an existing file.
deleteMetadata(oauth,file,id) Deletes an element (file or directory)
getFileVersions(oauth,id) Gets the version list for a specific file.
getFileVersionData(oauth,id,version,path) Downloads the contents of a specific version of an existing file.
To share folders and their contents among users of the same or different Personal Clouds, the Share tool is implemented in the file manager. The user can access the tool by selecting a Personal Cloud directory and then clicking the “Activity” tab in the right toolbar (social bar). This tab lists all users that can access and manage the active directory. Furthermore it indicates who is the owner of the directory. Where the directory is not shared, only the directory owner is displayed. If the user wants to share or add more users to the sharing list, they must right click on the directory to open a contextual menu and then select the “Share” option. When they select this option, a form appears in which they need to enter the email addresses of the people with whom they want to share the directory. Once the form has been completed, the data is sent to StackSync. If the operation is done successfully, the form closes. When the user accesses the “Activity” tab of the directory again, they will see the new users added to the list. The list of users sharing the directory is not refreshed, as there is no background process that enables new users to be displayed automatically. Directory sharing is implemented in eyeOS according to the diagram below: The user performs an action in the file manager, such as lists the users who have access to the directory. The Manager using the getListUsersShare function retrieves the user’s access token and the id of the directory in StackSync. These values are sent to the API, which is responsible for requesting the resource from StackSync using the getListUsersShare function. It receives the list of users and then it notifies the Manager, which will update the eyeOS interface. The getListUsersShare of the Share Manager and the Share API, as well as the other actions performed by the Share tool. Now are described in more detail, respectively: Share Manager getListUsersShare(token,id) Gets all users with access to a StackSync directory.
shareFolder(token,id,list) Shares a directory with another user.
Share API The configuration file of Share API is found at “/var/www/eyeos/eyeos/extern/u1db/” and is called “settings.py”. getListUsersShare(oauth,id) Gets all users with access to a StackSync directory.
shareFolder(oauth,id,list) Shares a directory with another user.
|