/
PermissionInfo.lua
44 lines (38 loc) · 1.02 KB
/
PermissionInfo.lua
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
--[[
Model for permission data, which is obtained through the PermissionsService.
Structure
boolean allowed: Whether or not the user has allowed the permission.
table data: Contains data specific to a permission type.
string domain: The URL domain of an HTTPService-type permission.
number index: The original index of the permission within the permission array of a given assetId.
Constants.PERMISSION_TYPES type: The permission's type.
]]
local PermissionInfo = {}
PermissionInfo.new = function()
return {
data = {},
allowed = false,
type = nil,
}
end
PermissionInfo.mock = function()
local result = PermissionInfo.new()
result.allowed = true
result.data = {
domain = "a",
}
return result
end
PermissionInfo.fromUserData = function(data, index)
local permission = PermissionInfo.new()
permission.type = data.Type
permission.index = index
if data.Data then
permission.allowed = data.Data.Allowed
permission.data = {
domain = data.Data.Domain,
}
end
return permission
end
return PermissionInfo