root / docs / collection_of_examples / sharing.rst @ 404eb288
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 |
Check publishing 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: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 |
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: f3b0c44298fc1c149afbf4c8996df92427ae41e4649b934ca495991b7852b857 |
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 a "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 |
Check current permissions. If none set, the object is unrestricted |
70 |
|
71 |
.. code-block:: console |
72 |
|
73 |
[file]: permissions get pithos:info.txt |
74 |
[file]: permissions get pithos:file2upload.txt |
75 |
read: local_user_group, write: s0m3-u53r-1d |
76 |
[file]: |
77 |
|
78 |
Let user with id `4n07h3r-u53r-1d` to have read access to `info.txt` and write |
79 |
access to `file2upload.txt`, and current user to have the opposite access |
80 |
|
81 |
.. code-block:: console |
82 |
|
83 |
[file]: permissions set pithos:info.txt read=4n07h3r-u53r-1d write=s0m3-u53r-1d |
84 |
[file]: permissions set pithos:file2upload.txt write=4n07h3r-u53r-1d read=s0m3-u53r-1d |
85 |
|
86 |
Check if everything is set correctly |
87 |
|
88 |
.. code-block:: console |
89 |
|
90 |
[file]: permissions get pithos:info.txt |
91 |
read: 4n07h3r-u53r-1d |
92 |
write: s0m3-u53r-1d |
93 |
[file]: permissions get pithos:file2upload.txt |
94 |
read: s0m3-u53r-1d |
95 |
write: 4n07h3r-u53r-1d |
96 |
[file]: |
97 |
|
98 |
Share (read permission) `info.txt` with all |
99 |
|
100 |
.. code-block:: console |
101 |
|
102 |
[file]: permissions set pithos:info.txt read=* |
103 |
|
104 |
Shared with me |
105 |
-------------- |
106 |
|
107 |
List user id of users who share objects with current user |
108 |
|
109 |
.. code-block:: console |
110 |
|
111 |
[file]: sharers |
112 |
5h4r1ng-u53r-1d |
113 |
4n07h3r-5h4r1ng-u53r-1d |
114 |
[file]: |
115 |
|
116 |
List containers of `5h4r1ng-u53r-1d` and then list `image` container |
117 |
|
118 |
.. code-block:: console |
119 |
|
120 |
[file]: list -A 5h4r1ng-u53r-1d |
121 |
image |
122 |
pithos |
123 |
trash |
124 |
[file]: list -A 5h4r1ng-u53r-1d image |
125 |
some-image.diskdump |
126 |
some-other-image.diskdump |
127 |
[file]: |
128 |
|
129 |
Copy the shared image `some-image.diskdump` to current pithos container |
130 |
|
131 |
.. code-block:: console |
132 |
|
133 |
[file]: copy -A 5h4r1ng-u53r-1d image:some-image.diskdump -D pithos |
134 |
[file]: |
135 |
|
136 |
Exit context |
137 |
------------ |
138 |
|
139 |
.. code-block:: console |
140 |
|
141 |
[file]: exit |
142 |
[kamaki]: |