Statistics
| Branch: | Tag: | Revision:

root / docs / examplesdir / sharing.rst @ f6822a26

History | View | Annotate | Download (4.2 kB)

1
Sharing
2
=======
3

    
4
In Pithos, an object can be published, shared with all or restricted to be
5
accessible by only some users or groups.
6

    
7
Enter context
8

    
9
.. code-block:: console
10

    
11
    [kamaki]: file
12
    [file]:
13

    
14
Publish and unpublish
15
---------------------
16

    
17
Get publishing information for objects `info.txt` and `file2upload.txt`
18

    
19
.. code-block:: console
20

    
21
    [file]: info pithos:info.txt
22
    cache-control:              no-cache, no-store, must-revalidate, max-age=0
23
    content-language:           en-us
24
    content-type:               plan-text/unicode
25
    date:                       Tue, 18 Jun 2013 12:54:14 GMT
26
    etag:                       d41d8cd98f00b204e9800998ecf8427e
27
    expires:                    Tue, 18 Jun 2013 12:54:14 GMT
28
    last-modified:              Mon, 17 Jun 2013 13:09:44 GMT
29
    server:                     gunicorn/0.14.5
30
    vary:                       X-Auth-Token,Accept-Language,Accept-Encoding
31
    x-object-hash:              e3b0c44298fc1c14....ca495991b7852b855
32
    x-object-modified-by:       s0m3-u53r-1d
33
    x-object-public:            https://example.com/pithos/public/14lhJnAhVU7
34
    x-object-uuid:              0493f1d9-9410-4f4b-a81f-fe42f9cefa70
35
    x-object-version:           1085
36
    x-object-version-timestamp: Mon, 17 Jun 2013 13:09:44 GMT
37
    [file]: info file2upload.txt
38
    cache-control:              no-cache, no-store, must-revalidate, max-age=0
39
    content-language:           en-us
40
    content-type:               plan-text/unicode
41
    date:                       Tue, 18 Jun 2013 12:54:14 GMT
42
    etag:                       c41d8cd98f00b304e9800998ecf8427g
43
    expires:                    Tue, 18 Jun 2013 12:54:14 GMT
44
    last-modified:              Mon, 17 Jun 2013 13:09:44 GMT
45
    server:                     gunicorn/0.14.5
46
    vary:                       X-Auth-Token,Accept-Language,Accept-Encoding
47
    x-object-hash:              f3b0c44298fc1c149af...a495991b7852b857
48
    x-object-modified-by:       s0m3-u53r-1d
49
    x-object-uuid:              0493f1d9-9410-4f4b-a81f-fe42f9cefa70
50
    x-object-version:           1085
51
    x-object-version-timestamp: Mon, 17 Jun 2013 13:09:44 GMT
52
    [file]:
53

    
54
.. note:: The first object contains an "x-object-public" field, therefore is
55
    published
56

    
57
Unpublish info.txt, publish file2upload.txt
58

    
59
.. code-block:: console
60

    
61
    [file]: unpublish pithos:info.txt
62
    [file]: publish pithos:file2upload.txt
63
    https://example.com/pithos/public/43gdL2df02ld3
64
    [file]:
65

    
66
Modify permissions
67
------------------
68

    
69
Get current permissions. If none set, the object inherits permissions from the
70
container and account (in that order).
71

    
72
.. code-block:: console
73

    
74
    [file]: permissions get pithos:info.txt
75
    [file]: permissions get pithos:file2upload.txt
76
    read: local_user_group, write: s0m3-u53r-1d
77
    [file]:
78

    
79
Let user with id `4n07h3r-u53r-1d` to have read access to `info.txt` and write
80
access to `file2upload.txt`, and current user to have the opposite access
81

    
82
.. code-block:: console
83

    
84
    [file]: permissions set pithos:info.txt read=4n07h3r-u53r-1d write=s0m3-u53r-1d
85
    [file]: permissions set pithos:file2upload.txt write=4n07h3r-u53r-1d read=s0m3-u53r-1d
86

    
87
Check if everything is set correctly
88

    
89
.. code-block:: console
90

    
91
    [file]: permissions get pithos:info.txt
92
    read: 4n07h3r-u53r-1d
93
    write: s0m3-u53r-1d
94
    [file]: permissions get pithos:file2upload.txt
95
    read: s0m3-u53r-1d
96
    write: 4n07h3r-u53r-1d
97
    [file]:
98

    
99
Share (read permission) `info.txt` with all
100

    
101
.. code-block:: console
102

    
103
    [file]: permissions set pithos:info.txt read=*
104

    
105
Shared with me
106
--------------
107

    
108
List user id of users who share objects with current user
109

    
110
.. code-block:: console
111

    
112
    [file]: sharers
113
    5h4r1ng-u53r-1d
114
    4n07h3r-5h4r1ng-u53r-1d
115
    [file]:
116

    
117
List containers of `5h4r1ng-u53r-1d` and then list `image` container
118

    
119
.. code-block:: console
120

    
121
    [file]: list -A 5h4r1ng-u53r-1d
122
    image
123
    pithos
124
    trash
125
    [file]: list -A 5h4r1ng-u53r-1d image
126
    some-image.diskdump
127
    some-other-image.diskdump
128
    [file]:
129

    
130
Copy the shared image `some-image.diskdump` to current pithos container
131

    
132
.. code-block:: console
133

    
134
    [file]: copy -A 5h4r1ng-u53r-1d image:some-image.diskdump -D pithos
135
    [file]:
136

    
137
Exit context
138
------------
139

    
140
.. code-block:: console
141

    
142
    [file]: exit
143
    [kamaki]: