1
0
Fork 0
mirror of synced 2024-05-17 19:22:34 +12:00

Change role:all to any in docs

This commit is contained in:
Steven 2022-09-14 12:18:33 -07:00 committed by GitHub
parent 9893bc166a
commit 6c9e805682
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 41 deletions

View file

@ -98,7 +98,7 @@ $ appwrite users list
To create a document you can use the following command
```sh
$ appwrite database createDocument --collectionId <ID> --documentId 'unique()' --data '{ "Name": "Iron Man" }' --read role:all team:abc
$ appwrite database createDocument --collectionId <ID> --documentId 'unique()' --data '{ "Name": "Iron Man" }' --permissions 'read("any")' 'read("team:abc")'
```
### Some Gotchas

View file

@ -3,14 +3,13 @@
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
```
Create a new user:
@ -18,12 +17,11 @@ Create a new user:
```dart
Users users = Users(client);
Response result = await users.create(
User result = await users.create(
userId: '[USER_ID]',
email: 'email@example.com',
password: 'password',
);
```
Fetch user profile:
@ -31,7 +29,7 @@ Fetch user profile:
```dart
Users users = Users(client);
Response profile = await users.get(
User profile = await users.get(
userId: '[USER_ID]',
);
```
@ -47,8 +45,9 @@ storage.createFile(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID
file: file,
read: ['role:all'],
write: []
permissions: [
Permission.read(Role.any()),
],
)
.then((response) {
print(response); // File uploaded!

View file

@ -3,14 +3,13 @@
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
```
Create a new user and session:
@ -18,9 +17,9 @@ Create a new user and session:
```dart
Account account = Account(client);
Response user = await account.create(email: 'me@appwrite.io', password: 'password', name: 'My Name');
final user = await account.create(userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name');
Response session = await account.createSession(email: 'me@appwrite.io', password: 'password');
final session = await account.createEmailSession(email: 'me@appwrite.io', password: 'password');
```
@ -29,7 +28,7 @@ Fetch user profile:
```dart
Account account = Account(client);
Response profile = await account.get();
final profile = await account.get();
```
Upload File:
@ -37,12 +36,21 @@ Upload File:
```dart
Storage storage = Storage(client);
MultipartFile file = MultipartFile.fromFile('./path-to-file/image.jpg', filename: 'image.jpg');
late InputFile file;
if(kIsWeb) {
file = InputFile(bytes: pickedFile.bytes, filename: 'image.jpg');
} else {
file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg');
}
storage.createFile(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID
file: file,
read: ['role:all'],
write: []
permissions: [
Permission.read(Role.any()),
],
)
.then((response) {
print(response); // File uploaded!

View file

@ -3,14 +3,13 @@
Init your Appwrite client:
```dart
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
Client client = Client();
client
.setEndpoint('https://localhost/v1') // Your Appwrite Endpoint
.setProject('5e8cf4f46b5e8') // Your project ID
.setSelfSigned() // Remove in production
;
```
Create a new user and session:
@ -18,9 +17,9 @@ Create a new user and session:
```dart
Account account = Account(client);
Response user = await account.create(userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name');
final user = await account.create(userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name');
Response session = await account.createSession(email: 'me@appwrite.io', password: 'password');
final session = await account.createEmailSession(email: 'me@appwrite.io', password: 'password');
```
@ -29,7 +28,7 @@ Fetch user profile:
```dart
Account account = Account(client);
Response profile = await account.get();
final profile = await account.get();
```
Upload File:
@ -40,7 +39,7 @@ Storage storage = Storage(client);
late InputFile file;
if(kIsWeb) {
file = InputFile(file: await MultipartFile.fromFile('file', './path-to-file/image.jpg', filename: 'image.jpg'));
file = InputFile(bytes: pickedFile.bytes, filename: 'image.jpg');
} else {
file = InputFile(path: './path-to-file/image.jpg', filename: 'image.jpg');
}
@ -49,8 +48,9 @@ storage.createFile(
bucketId: '[BUCKET_ID]',
fileId: '[FILE_ID]', // use 'unique()' to automatically generate a unique ID
file: file,
read: ['role:all'],
write: []
permissions: [
Permission.read(Role.any()),
],
)
.then((response) {
print(response); // File uploaded!

View file

@ -4,4 +4,4 @@ All data returned by the Databases service are represented as structured JSON do
The Databases service can contain multiple databases, each database can contain multiple collections. A collection is a group of similarly structured documents. The accepted structure of documents is defined by [collection attributes](/docs/databases#attributes). The collection attributes help you ensure all your user-submitted data is validated and stored according to the collection structure.
Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (`role:all`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions).
Using Appwrite permissions architecture, you can assign read or write access to each collection or document in your project for either a specific user, team, user role, or even grant it with public access (`any`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions).

View file

@ -2,7 +2,7 @@ The Storage service allows you to manage your project files. Using the Storage s
Files are managed using buckets. Storage buckets are similar to Collections we have in our [Databases](/docs/databases) service. The difference is, buckets also provide more power to decide what kinds of files, what sizes you want to allow in that bucket, whether or not to encrypt the files, scan with antivirus and more.
Using Appwrite permissions architecture, you can assign read or write access to each bucket or file in your project for either a specific user, team, user role, or even grant it with public access (`role:all`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions).
Using Appwrite permissions architecture, you can assign read or write access to each bucket or file in your project for either a specific user, team, user role, or even grant it with public access (`any`). You can learn more about [how Appwrite handles permissions and access control](/docs/permissions).
The preview endpoint allows you to generate preview images for your files. Using the preview endpoint, you can also manipulate the resulting image so that it will fit perfectly inside your app in terms of dimensions, file size, and style. The preview endpoint also allows you to change the resulting image file format for better compression or image quality for better delivery over the network.