Typos in documentation
[kamaki] / docs / examplesdir / sharing.rst
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 Publish and unpublish
8 ---------------------
9
10 Get publishing information for objects `info.txt` and `file2upload.txt`
11
12 .. code-block:: console
13
14     $ kamaki file info info.txt
15     cache-control:              no-cache, no-store, must-revalidate, max-age=0
16     content-language:           en-us
17     content-type:               plan-text/unicode
18     date:                       Tue, 18 Jun 2013 12:54:14 GMT
19     etag:                       d41d8cd98f00b204e9800998ecf8427e
20     expires:                    Tue, 18 Jun 2013 12:54:14 GMT
21     last-modified:              Mon, 17 Jun 2013 13:09:44 GMT
22     server:                     gunicorn/0.14.5
23     vary:                       X-Auth-Token,Accept-Language,Accept-Encoding
24     x-object-hash:              e3b0c44298fc1c14....ca495991b7852b855
25     x-object-modified-by:       s0m3-u53r-1d
26     x-object-public:            https://example.com/pithos/public/14lhJnAhVU7
27     x-object-uuid:              0493f1d9-9410-4f4b-a81f-fe42f9cefa70
28     x-object-version:           1085
29     x-object-version-timestamp: Mon, 17 Jun 2013 13:09:44 GMT
30     $ kamaki file info file2upload.txt
31     cache-control:              no-cache, no-store, must-revalidate, max-age=0
32     content-language:           en-us
33     content-type:               plan-text/unicode
34     date:                       Tue, 18 Jun 2013 12:54:14 GMT
35     etag:                       c41d8cd98f00b304e9800998ecf8427g
36     expires:                    Tue, 18 Jun 2013 12:54:14 GMT
37     last-modified:              Mon, 17 Jun 2013 13:09:44 GMT
38     server:                     gunicorn/0.14.5
39     vary:                       X-Auth-Token,Accept-Language,Accept-Encoding
40     x-object-hash:              f3b0c44298fc1c149af...a495991b7852b857
41     x-object-modified-by:       s0m3-u53r-1d
42     x-object-uuid:              0493f1d9-9410-4f4b-a81f-fe42f9cefa70
43     x-object-version:           1085
44     x-object-version-timestamp: Mon, 17 Jun 2013 13:09:44 GMT
45
46 .. note:: The first object contains an "x-object-public" field, therefore is
47     published. Alternatively, use the "--sharing" argument
48
49     .. code-block:: console
50
51         $ kamaki file info info.txt --sharing
52         public url: https://example.com/pithos/public/14lhJnAhVU7
53
54 Unpublish info.txt, publish file2upload.txt
55
56 .. code-block:: console
57
58     $ kamaki file modify /pithos/info.txt --unpublish
59     $ kamaki file modify /pithos/file2upload.txt --publish
60     https://example.com/pithos/public/43gdL2df02ld3
61
62 Modify permissions
63 ------------------
64
65 Get current permissions. If none set, the object inherits permissions from the
66 container and account (in that order).
67
68 .. code-block:: console
69
70     $ kamaki file info info.txt --sharing
71     public url: https://example.com/pithos/public/14lhJnAhVU7
72     $ kamaki file info file2upload.txt --sharing
73     read: local_user_group, write: s0m3-u53r-1d
74     public url: https://example.com/pithos/public/43gdL2df02ld3
75
76 Let user with id `4n07h3r-u53r-1d` to have read access to `info.txt` and write
77 access to `file2upload.txt`, and current user to have the opposite access
78
79 .. code-block:: console
80
81     $ kamaki file modify info.txt --read-permission=4n07h3r-u53r-1d --write-permission=s0m3-u53r-1d
82     $ kamaki file modify file2upload.txt --write-permission=4n07h3r-u53r-1d --read-permission=s0m3-u53r-1d
83
84 Share (read permission) `info.txt` with all
85
86 .. code-block:: console
87
88     $ kamaki file modify info.txt --read-permission=*
89
90 Shared with me
91 --------------
92
93 List users who share objects with current user
94
95 .. code-block:: console
96
97     $ kamaki sharer list
98     5h4r1ng-u53r-1d (somesharinguser@example.com)
99     4n07h3r-5h4r1ng-u53r-1d (anothersharinguser@example.com)
100
101 List containers of `5h4r1ng-u53r-1d` and then list `images` container
102
103 .. code-block:: console
104
105     $ kamaki container list -A 5h4r1ng-u53r-1d
106     images
107     pithos
108     trash
109     $ kamaki file list -A 5h4r1ng-u53r-1d /images
110     some-image.diskdump
111     some-other-image.diskdump
112
113 Copy the shared image `some-image.diskdump` to current pithos container
114
115 .. code-block:: console
116
117     $ kamaki file copy -A 5h4r1ng-u53r-1d /images/some-image.diskdump /pithos
118
119     OR
120
121     $ kamaki file copy pithos://5h4r1ng-u53r-1d/images/some-image.diskdump /pithos