Hello I'm trying to create a document and set a label permission but It doesn't create the document just returns an error, the other permissions seem to work though
Code:
TypeScript
@override
Future<void> uploadContent({
String? customId,
required ContentModel contentModel,
}) async {
const String errorMessage = "Failed to upload content";
final String documentId = customId ?? ID.unique();
Map<dynamic, dynamic> data = contentModel.toJson()
..["academyId"] = uid
..remove("\$id")
..remove("\$createdAt");
try {
await databases.createDocument(
databaseId: Env.databaseId,
collectionId: Env.contentCollectionId,
documentId: documentId,
data: data,
permissions: [
Permission.read(Role.label("content")),
]);
} on AppwriteException catch (e) {
print(e);
throw ContentException("$errorMessage: ${e.message}");
} catch (e) {
throw ContentException("$errorMessage: $e");
}
}
Error:
TypeScript
TL;DR
Developers are encountering an 'user_unauthorized' error when trying to set label permissions while creating a document. The issue may be due to incorrect permission setting. The error message specifies that permissions must be one of: any, users, user: [ specific ID ], user: [ specific ID ]/verified, users/verified, label: [ specific label ]. Make sure the permission setting matches one of these options to resolve the issue.Anyone know what's going on?
Recommended threads
- Upgrading selfhost version?
It is okay to upgrade version to higher one, of my current version is 1.7.4 to 1.8.1. Is that safe to do cause my clients already have data on that? Also is a...
- Local Serverless Function Testing: Are D...
I have followed the instructions to get the CLI working, and have been able to log-in, initialize my project, and created a simple Python function, which calls ...
- Update user email using OTP
Hi, I am trying to implement email update using OTP, there is not password associated with the account. One solution I found online is creating appwrite functio...