summaryrefslogtreecommitdiff
path: root/docs/Classes/SDLPermissionManager.html
blob: d2602b9f43cff8302c0c493c8320867fa961f8a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<h1>SDLPermissionManager Class Reference</h1>

<h3>Section Contents</h3>

<ul>
  <li><a href="#section-requiresEncryption">requiresEncryption</a></li>
  <li><a href="#section--startWithCompletionHandler:">-startWithCompletionHandler:</a></li>
  <li><a href="#section--stop">-stop</a></li>
  <li><a href="#section--isRPCNameAllowed:">-isRPCNameAllowed:</a></li>
  <li><a href="#section--groupStatusOfRPCPermissions:">-groupStatusOfRPCPermissions:</a></li>
  <li><a href="#section--statusesOfRPCPermissions:">-statusesOfRPCPermissions:</a></li>
  <li><a href="#section--subscribeToRPCPermissions:groupType:withHandler:">-subscribeToRPCPermissions:groupType:withHandler:</a></li>
  <li><a href="#section--removeAllObservers">-removeAllObservers</a></li>
  <li><a href="#section--removeObserverForIdentifier:">-removeObserverForIdentifier:</a></li>
  <li><a href="#section--rpcNameRequiresEncryption:">-rpcNameRequiresEncryption:</a></li>
  <li><a href="#section--isPermissionParameterAllowed:parameter:">-isPermissionParameterAllowed:parameter:</a></li>
</ul>

<h3>Overview</h3>

<p>The permission manager monitoring RPC permissions.</p>


<section class="section task-group-section">
  <h3 id="section-requiresEncryption">
      requiresEncryption
  </h3>
  
  <p>Flag indicating if the app requires an encryption service to be active.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">@property</span> <span class="p">(</span><span class="n">nonatomic</span><span class="p">,</span> <span class="n">readonly</span><span class="p">)</span> <span class="n">BOOL</span> <span class="n">requiresEncryption</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="k">var</span> <span class="nv">requiresEncryption</span><span class="p">:</span> <span class="kt">Bool</span> <span class="p">{</span> <span class="k">get</span> <span class="p">}</span></code></pre>

  
  
  
  <h3 id="section--startWithCompletionHandler:">
      -startWithCompletionHandler:
  </h3>
  
  <p>Start the manager with a completion block that will be called when startup completes. This is used internally. To use an SDLPermissionManager, you should use the manager found on <code><a href="../Classes/SDLManager.html">SDLManager</a></code>.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">startWithCompletionHandler</span><span class="p">:</span>
    <span class="p">(</span><span class="n">nonnull</span> <span class="kt">void</span> <span class="p">(</span><span class="o">^</span><span class="p">)(</span><span class="n">BOOL</span><span class="p">,</span> <span class="n">NSError</span> <span class="o">*</span><span class="n">_Nullable</span><span class="p">))</span><span class="nv">completionHandler</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">start</span><span class="p">(</span><span class="nv">completionHandler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="p">(</span><span class="kt">Bool</span><span class="p">,</span> <span class="kt">Error</span><span class="p">?)</span> <span class="o">-&gt;</span> <span class="kt">Void</span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>completionHandler</dt>
      <dd><p>The block to be called when the manager&rsquo;s setup is complete.</p></dd>
  </dl>
  
  <h3 id="section--stop">
      -stop
  </h3>
  
  <p>Stop the manager. This method is used internally.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">stop</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">stop</span><span class="p">()</span></code></pre>

  
  
  
  <h3 id="section--isRPCNameAllowed:">
      -isRPCNameAllowed:
  </h3>
  
  <p>Determine if an individual RPC is allowed for the current HMI level</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">BOOL</span><span class="p">)</span><span class="nf">isRPCNameAllowed</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span><span class="p">)</span><span class="nv">rpcName</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isRPCNameAllowed</span><span class="p">(</span><span class="n">_</span> <span class="nv">rpcName</span><span class="p">:</span> <span class="kt"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcName</dt>
      <dd><p>The name of the RPC to be tested, for example, SDLRPCFunctionNameShow</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>YES if the RPC is allowed at the current HMI level, NO if not</p>
  </div>
  
  <h3 id="section--groupStatusOfRPCPermissions:">
      -groupStatusOfRPCPermissions:
  </h3>
  
  <p>Determine if all RPCs are allowed for the current HMI level</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n"><a href="../Enums/SDLPermissionGroupStatus.html">SDLPermissionGroupStatus</a></span><span class="p">)</span><span class="nf">groupStatusOfRPCPermissions</span><span class="p">:</span>
    <span class="p">(</span><span class="n">nonnull</span> <span class="n">NSArray</span><span class="o">&lt;</span><span class="n"><a href="../Classes/SDLPermissionElement.html">SDLPermissionElement</a></span> <span class="o">*&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nv">rpcNames</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">groupStatus</span><span class="p">(</span><span class="n">ofRPCPermissions</span> <span class="nv">rpcNames</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/SDLPermissionElement.html">SDLPermissionElement</a></span><span class="p">])</span> <span class="o">-&gt;</span> <span class="kt"><a href="../Enums/SDLPermissionGroupStatus.html">SDLPermissionGroupStatus</a></span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcNames</dt>
      <dd><p>The RPCs to check</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>AllAllowed if all of the permissions are allowed, AllDisallowed if all the permissions are disallowed, Any if some are allowed, and some are disallowed</p>
  </div>
  
  <h3 id="section--statusesOfRPCPermissions:">
      -statusesOfRPCPermissions:
  </h3>
  
  <p>Retrieve a dictionary with keys that are the passed in RPC names, and objects of an NSNumber<BOOL> specifying if that RPC is currently allowed</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n">NSDictionary</span><span class="o">&lt;</span><span class="n"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span><span class="p">,</span> <span class="n"><a href="../Classes/SDLRPCPermissionStatus.html">SDLRPCPermissionStatus</a></span> <span class="o">*&gt;</span> <span class="o">*</span><span class="p">)</span>
    <span class="nf">statusesOfRPCPermissions</span><span class="p">:</span>
        <span class="p">(</span><span class="n">nonnull</span> <span class="n">NSArray</span><span class="o">&lt;</span><span class="n"><a href="../Classes/SDLPermissionElement.html">SDLPermissionElement</a></span> <span class="o">*&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nv">rpcNames</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">statuses</span><span class="p">(</span><span class="n">ofRPCPermissions</span> <span class="nv">rpcNames</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/SDLPermissionElement.html">SDLPermissionElement</a></span><span class="p">])</span> <span class="o">-&gt;</span> <span class="p">[</span><span class="kt"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span> <span class="p">:</span> <span class="kt"><a href="../Classes/SDLRPCPermissionStatus.html">SDLRPCPermissionStatus</a></span><span class="p">]</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcNames</dt>
      <dd><p>An array of permission elements to check</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>A dictionary with specific RPC info contained in a SDLRPCPermissionStatus</p>
  </div>
  
  <h3 id="section--subscribeToRPCPermissions:groupType:withHandler:">
      -subscribeToRPCPermissions:groupType:withHandler:
  </h3>
  
  <p>Subscribe to specified RPC names, with a callback that will be called whenever the value changes. The callback will only return immediately if the groupType is set to SDLPermissionGroupTypeAny or if the groupType is set to SDLPermissionGroupTypeAllAllowed and all RPCs in the rpcNames parameter are allowed.</p>
<div class="aside aside-warning">
    <p class="aside-title">Warning</p>
    <p>The observer may be called before this method returns. Do not attempt to remove the observer from within the observer.</p>

</div>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionObserverIdentifier">SDLPermissionObserverIdentifier</a></span><span class="p">)</span>
    <span class="nf">subscribeToRPCPermissions</span><span class="p">:</span>
        <span class="p">(</span><span class="n">nonnull</span> <span class="n">NSArray</span><span class="o">&lt;</span><span class="n"><a href="../Classes/SDLPermissionElement.html">SDLPermissionElement</a></span> <span class="o">*&gt;</span> <span class="o">*</span><span class="p">)</span><span class="nv">permissionElements</span>
                    <span class="nf">groupType</span><span class="p">:(</span><span class="n"><a href="../Enums/SDLPermissionGroupType.html">SDLPermissionGroupType</a></span><span class="p">)</span><span class="nv">groupType</span>
                  <span class="nf">withHandler</span><span class="p">:</span>
                      <span class="p">(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLRPCPermissionStatusChangedHandler">SDLRPCPermissionStatusChangedHandler</a></span><span class="p">)</span><span class="nv">handler</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">subscribe</span><span class="p">(</span><span class="n">toRPCPermissions</span> <span class="nv">permissionElements</span><span class="p">:</span> <span class="p">[</span><span class="kt"><a href="../Classes/SDLPermissionElement.html">SDLPermissionElement</a></span><span class="p">],</span> <span class="nv">groupType</span><span class="p">:</span> <span class="kt"><a href="../Enums/SDLPermissionGroupType.html">SDLPermissionGroupType</a></span><span class="p">,</span> <span class="n">withHandler</span> <span class="nv">handler</span><span class="p">:</span> <span class="kd">@escaping</span> <span class="kt"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLRPCPermissionStatusChangedHandler">SDLRPCPermissionStatusChangedHandler</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">UUID</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>permissionElements</dt>
      <dd><p>The permission elements to be observed</p></dd>
      <dt>groupType</dt>
      <dd><p>Affects the times that the observer block will be called. If Any, any change to any RPC in rpcNames will cause the observer block to be called. If AllAllowed, the block will be called when: 1. Every RPC in rpcNames becomes allowed 2. The group of rpcNames goes from all being allowed to some or all being disallowed.</p></dd>
      <dt>handler</dt>
      <dd><p>The block that will be called whenever permissions change.</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>An identifier that can be passed to removeObserverForIdentifer: to remove the observer</p>
  </div>
  
  <h3 id="section--removeAllObservers">
      -removeAllObservers
  </h3>
  
  <p>Remove every current observer</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="n">removeAllObservers</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">removeAllObservers</span><span class="p">()</span></code></pre>

  
  
  
  <h3 id="section--removeObserverForIdentifier:">
      -removeObserverForIdentifier:
  </h3>
  
  <p>Remove block observers for the specified RPC</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="kt">void</span><span class="p">)</span><span class="nf">removeObserverForIdentifier</span><span class="p">:</span>
    <span class="p">(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLPermissionConstants.h@T@SDLPermissionObserverIdentifier">SDLPermissionObserverIdentifier</a></span><span class="p">)</span><span class="nv">identifier</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">removeObserver</span><span class="p">(</span><span class="n">forIdentifier</span> <span class="nv">identifier</span><span class="p">:</span> <span class="kt">UUID</span><span class="p">)</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>identifier</dt>
      <dd><p>The identifier specifying which observer to remove</p></dd>
  </dl>
  
  <h3 id="section--rpcNameRequiresEncryption:">
      -rpcNameRequiresEncryption:
  </h3>
  
  <p>Check whether or not an RPC needs encryption.</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">BOOL</span><span class="p">)</span><span class="nf">rpcNameRequiresEncryption</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span><span class="p">)</span><span class="nv">rpcName</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">rpcNameRequiresEncryption</span><span class="p">(</span><span class="n">_</span> <span class="nv">rpcName</span><span class="p">:</span> <span class="kt"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

  
  
  
  <h3 id="section--isPermissionParameterAllowed:parameter:">
      -isPermissionParameterAllowed:parameter:
  </h3>
  
  <p>Check whether a parameter of an RPC is allowed</p>

  
  
  <h4>Objective-C</h4>
  <pre class="highlight objective_c"><code><span class="k">-</span> <span class="p">(</span><span class="n">BOOL</span><span class="p">)</span><span class="nf">isPermissionParameterAllowed</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span><span class="p">)</span><span class="nv">rpcName</span>
                           <span class="nf">parameter</span><span class="p">:(</span><span class="n">nonnull</span> <span class="n">NSString</span> <span class="o">*</span><span class="p">)</span><span class="nv">parameter</span><span class="p">;</span></code></pre>

  
  <h4>Swift</h4>
  <pre class="highlight swift"><code><span class="kd">func</span> <span class="nf">isPermissionParameterAllowed</span><span class="p">(</span><span class="n">_</span> <span class="nv">rpcName</span><span class="p">:</span> <span class="kt"><a href="../Type%20Definitions.html#/c:SDLRPCFunctionNames.h@T@SDLRPCFunctionName">SDLRPCFunctionName</a></span><span class="p">,</span> <span class="nv">parameter</span><span class="p">:</span> <span class="kt">String</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kt">Bool</span></code></pre>

  
  
  <h4>Parameters</h4>
  <dl>
      <dt>rpcName</dt>
      <dd><p>The name of the RPC to be tested, for example, SDLRPCFunctionNameGetVehicleData</p></dd>
      <dt>parameter</dt>
      <dd><p>The name of the parameter to be tested, for example, rpm</p></dd>
  </dl>
  <div>
    <h4>Return Value</h4>
    <p>True if the parameter is allowed, false if it is not</p>
  </div>
  
</section>