Fix permissions for tags and appdata

This ties those namespaces to the things permissions but won't
allow having different tags/appdata per user, which arguably would
be desirable. However, that's currently not that straight forward
to do, as at the moment there is no way to direct jsonrpc notifications
to a single user.
This commit is contained in:
Michael Zanetti 2022-11-07 23:58:00 +01:00
parent 6171a16157
commit 9296c1183c
3 changed files with 20 additions and 20 deletions

View File

@ -26,7 +26,7 @@ AppDataHandler::AppDataHandler(QObject *parent) : JsonHandler(parent)
params.insert("o:group", enumValueName(String));
params.insert("key", enumValueName(String));
params.insert("value", enumValueName(String));
registerMethod("Store", description, params, returns);
registerMethod("Store", description, params, returns, Types::PermissionScopeConfigureThings);
description.clear(); params.clear(); returns.clear();
description = "Retrieve an app data storage value that has previously been set with Store(). If no value "
@ -35,7 +35,7 @@ AppDataHandler::AppDataHandler(QObject *parent) : JsonHandler(parent)
params.insert("o:group", enumValueName(String));
params.insert("key", enumValueName(String));
returns.insert("value", enumValueName(String));
registerMethod("Load", description, params, returns);
registerMethod("Load", description, params, returns, Types::PermissionScopeControlThings);
// Notifications
description.clear(); params.clear();

View File

@ -54,7 +54,7 @@ TagsHandler::TagsHandler(QObject *parent) : JsonHandler(parent)
params.insert("o:tagId", enumValueName(String));
returns.insert("tagError", enumRef<TagsStorage::TagError>());
returns.insert("o:tags", objectRef("Tags"));
registerMethod("GetTags", description, params, returns);
registerMethod("GetTags", description, params, returns, Types::PermissionScopeControlThings);
params.clear(); returns.clear();
description = "Add a Tag. "
@ -65,7 +65,7 @@ TagsHandler::TagsHandler(QObject *parent) : JsonHandler(parent)
"the TagValueChanged notification will be emitted.";
params.insert("tag", objectRef("Tag"));
returns.insert("tagError", enumRef<TagsStorage::TagError>());
registerMethod("AddTag", description, params, returns);
registerMethod("AddTag", description, params, returns, Types::PermissionScopeControlThings);
params.clear(); returns.clear();
description = "Remove a Tag. "
@ -73,7 +73,7 @@ TagsHandler::TagsHandler(QObject *parent) : JsonHandler(parent)
"TagRemoved notification will be emitted.";
params.insert("tag", objectRef("Tag"));
returns.insert("tagError", enumRef<TagsStorage::TagError>());
registerMethod("RemoveTag", description, params, returns);
registerMethod("RemoveTag", description, params, returns, Types::PermissionScopeControlThings);
// Notifications
params.clear();

View File

@ -566,7 +566,7 @@
"key": "String",
"o:group": "String"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeControlThings",
"returns": {
"value": "String"
}
@ -579,7 +579,7 @@
"o:group": "String",
"value": "String"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeConfigureThings",
"returns": {
}
},
@ -1595,7 +1595,7 @@
"o:stateEvaluator": "$ref:StateEvaluator",
"o:timeDescriptor": "$ref:TimeDescriptor"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeConfigureRules",
"returns": {
"o:ruleId": "Uuid",
"ruleError": "$ref:RuleError"
@ -1606,7 +1606,7 @@
"params": {
"ruleId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeConfigureRules",
"returns": {
"ruleError": "$ref:RuleError"
}
@ -1630,7 +1630,7 @@
"o:timeDescriptor": "$ref:TimeDescriptor",
"ruleId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeConfigureRules",
"returns": {
"o:rule": "$ref:Rule",
"ruleError": "$ref:RuleError"
@ -1641,7 +1641,7 @@
"params": {
"ruleId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeConfigureRules",
"returns": {
"ruleError": "$ref:RuleError"
}
@ -1651,7 +1651,7 @@
"params": {
"ruleId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeExecuteRules",
"returns": {
"ruleError": "$ref:RuleError"
}
@ -1661,7 +1661,7 @@
"params": {
"ruleId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeExecuteRules",
"returns": {
"ruleError": "$ref:RuleError"
}
@ -1671,7 +1671,7 @@
"params": {
"thingId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeExecuteRules",
"returns": {
"ruleIds": [
"Uuid"
@ -1683,7 +1683,7 @@
"params": {
"ruleId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeExecuteRules",
"returns": {
"o:rule": "$ref:Rule",
"ruleError": "$ref:RuleError"
@ -1693,7 +1693,7 @@
"description": "Get the descriptions of all configured rules. If you need more information about a specific rule use the method Rules.GetRuleDetails.",
"params": {
},
"permissionScope": "PermissionScopeConfigureRules",
"permissionScope": "PermissionScopeExecuteRules",
"returns": {
"ruleDescriptions": [
"$ref:RuleDescription"
@ -1705,7 +1705,7 @@
"params": {
"ruleId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeConfigureRules",
"returns": {
"ruleError": "$ref:RuleError"
}
@ -1935,7 +1935,7 @@
"params": {
"tag": "$ref:Tag"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeControlThings",
"returns": {
"tagError": "$ref:TagError"
}
@ -1948,7 +1948,7 @@
"o:tagId": "String",
"o:thingId": "Uuid"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeControlThings",
"returns": {
"o:tags": "$ref:Tags",
"tagError": "$ref:TagError"
@ -1959,7 +1959,7 @@
"params": {
"tag": "$ref:Tag"
},
"permissionScope": "PermissionScopeAdmin",
"permissionScope": "PermissionScopeControlThings",
"returns": {
"tagError": "$ref:TagError"
}