Skip to content

Commit

Permalink
Merge pull request appwrite#3841 from appwrite/fix-role-all
Browse files Browse the repository at this point in the history
Change role:all to any in docs
  • Loading branch information
christyjacob4 authored Sep 14, 2022
2 parents e04b9fc + 6c9e805 commit 19eb6c7
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 41 deletions.
2 changes: 1 addition & 1 deletion docs/sdks/cli/GETTING_STARTED.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 11 additions & 12 deletions docs/sdks/dart/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,35 +3,33 @@
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:

```dart
Users users = Users(client);
Response result = await users.create(
User result = await users.create(
userId: '[USER_ID]',
email: '[email protected]',
password: 'password',
);
```

Fetch user profile:

```dart
Users users = Users(client);
Response profile = await users.get(
User profile = await users.get(
userId: '[USER_ID]',
);
```
Expand All @@ -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!
Expand Down
34 changes: 21 additions & 13 deletions docs/sdks/flutter-dev/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
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:

```dart
Account account = Account(client);
Response user = await account.create(email: '[email protected]', password: 'password', name: 'My Name');
final user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name');
Response session = await account.createSession(email: '[email protected]', password: 'password');
final session = await account.createEmailSession(email: '[email protected]', password: 'password');
```

Expand All @@ -29,20 +28,29 @@ Fetch user profile:
```dart
Account account = Account(client);
Response profile = await account.get();
final profile = await account.get();
```

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!
Expand Down
26 changes: 13 additions & 13 deletions docs/sdks/flutter/EXAMPLES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,23 @@
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:

```dart
Account account = Account(client);
Response user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name');
final user = await account.create(userId: '[USER_ID]', email: '[email protected]', password: 'password', name: 'My Name');
Response session = await account.createSession(email: '[email protected]', password: 'password');
final session = await account.createEmailSession(email: '[email protected]', password: 'password');
```

Expand All @@ -29,7 +28,7 @@ Fetch user profile:
```dart
Account account = Account(client);
Response profile = await account.get();
final profile = await account.get();
```

Upload File:
Expand All @@ -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');
}
Expand All @@ -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!
Expand Down
2 changes: 1 addition & 1 deletion docs/services/databases.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
2 changes: 1 addition & 1 deletion docs/services/storage.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 19eb6c7

Please sign in to comment.