Introduce platform services
[src/app-framework-main.git] / docs / 3-permissions.md
1 # The permissions
2
3 ## Permission's names
4
5 The proposal here is to specify a naming scheme for permissions
6 that allows the system to be as stateless as possible.  
7 The current specification includes in the naming of permissions either
8 the name of the bound binding when existing and the level of the
9 permission itself.  
10 Doing this, there is no real need for the
11 framework to keep installed permissions in a database.
12
13 The permission names are [URN][URN] of the form:
14
15 ```bash
16     urn:AGL:permission:<api>:<level>:<hierarchical-name>
17 ```
18
19 where "AGL" is the NID (the namespace identifier) dedicated to AGL.  
20 (note: a RFC should be produced to standardize this name space)
21
22 The permission names are made of NSS (the namespace specific string)
23 starting with "permission:" and followed by colon separated
24 fields.  
25 The 2 first fields are `<api>` and `<level>` and the remaining
26 fields are grouped to form the `<hierarchical-name>`.
27
28 ```bash
29     <api> ::= [ <pname> ]
30
31     <pname> ::= 1*<pchars>
32
33     <pchars> ::= <upper> | <lower> | <number> | <extra>
34
35     <extra> ::= "-" | "." | "_" | "@"
36 ```
37
38 The field `<api>` can be made of any valid character for NSS except
39 the characters colon and star (:*).  
40 This field designates the api providing the permission.  
41 This scheme is used to deduce binding requirements
42 from permission requirements.  
43 The field `<api>` can be the empty string when the permission
44 is defined by the AGL system itself.
45
46 [PROPOSAL 1] The field `<api>` if starting with the character "@" represents
47 a transversal/cross permission not bound to any binding.
48
49 [PROPOSAL 2]The field `<api>` if starting with the 2 characters "@@"
50 in addition to a permission not bound to any binding, represents a
51 permission that must be set at installation and that can not be
52 revoked later.
53
54     <level> ::= 1*<lower>
55
56 The field `<level>` is made only of letters in lower case.  
57 The field `<level>` can only take some predefined values:
58
59 - system
60 - platform
61 - partner
62 - tiers
63 - owner
64 - public
65
66 The field `<hierarchical-name>` is made of `<pname>` separated
67 by colons.
68
69     <hierarchical-name> ::= <pname> 0*(":" <pname>)
70
71 The names at left are hierarchically grouping the
72 names at right.  
73 This hierarchical behaviour is intended to
74 be used to request permissions using hierarchical grouping.
75
76 ## Permission value
77
78 In some case, it could be worth to add a value to a permission.
79
80 Currently, the framework allows it for permissions linked to
81 systemd.  
82 But this not currently used.
83
84 Conversely, permissions linked to cynara can't carry data
85 except in their name.
86
87 Thus to have a simple and cleaner model, it is better to forbid
88 attachment of value to permission.
89
90 ## Example of permissions
91
92 Here is a list of some possible permissions.  
93 These permissions are available the 21th of May 2019.
94
95 - urn:AGL:permission::platform:no-oom  
96   Set OOMScoreAdjust=-500 to keep the out-of-memory
97   killer away.
98 - urn:AGL:permission::partner:real-time  
99   Set IOSchedulingClass=realtime to give to the process
100   realtime scheduling.  
101   Conversely, not having this permission set RestrictRealtime=on
102   to forbid realtime features.
103 - urn:AGL:permission::public:display  
104   Adds the group "display" to the list of supplementary groups
105   of the process.
106 - urn:AGL:permission::public:syscall:clock  
107   Without this permission SystemCallFilter=~@clock is set to
108   forfid call to clock.
109 - urn:AGL:permission::public:no-htdocs  
110   The http directory served is not "htdocs" but "."
111 - urn:AGL:permission::public:applications:read  
112   Allows to read data of installed applications (and to
113   access icons).
114 - urn:AGL:permission::partner:service:no-ws  
115   Forbids services to provide its API through websocket.
116 - urn:AGL:permission::partner:service:no-dbus  
117   Forbids services to provide its API through D-Bus.
118 - urn:AGL:permission::system:run-by-default  
119   Starts automatically the application. Example: home-screen.
120 - urn:AGL:permission::partner:scope-platform
121   Install the service at the scope of the platform.
122 - urn:AGL:permission::system:capability:keep-all
123   Keep all capabilities for the service. Note that implementing
124   that permission is not mandatory or can be adapted for the given
125   system.
126 - <http://tizen.org/privilege/internal/dbus>
127   Permission to use D-Bus.
128
129 [URN]: https://tools.ietf.org/rfc/rfc2141.txt "RFC 2141: URN Syntax"