Skip to content

Update roles.md code snippets (partially) to Swift 4.2 + Parse 1.7.2 #582

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions _includes/ios/roles.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ PFRole *role = [PFRole roleWithName:@"Administrator" acl:roleACL];
```
```swift
// By specifying no write privileges for the ACL, we can ensure the role cannot be altered.
var roleACL = PFACL.ACL()
var roleACL = PFACL()
roleACL.setPublicReadAccess(true)
var role = PFRole.roleWithName("Administrator", acl:roleACL)
role.saveInBackground()
Expand Down Expand Up @@ -83,8 +83,8 @@ wallPost.ACL = postACL;
```
```swift
var moderators = /* Query for some PFRole */
var wallPost = PFObject(className:"WallPost")
var postACL = PFACL.ACL()
var wallPost = PFObject(className: "WallPost")
var postACL = PFACL()
postACL.setWriteAccess(true, forRole:moderators)
wallPost.ACL = postACL
wallPost.saveInBackground()
Expand All @@ -102,9 +102,9 @@ wallPost.ACL = postACL;
[wallPost saveInBackground];
```
```swift
var wallPost = PFObject(className:"WallPost")
var postACL = PFACL.ACL()
postACL.setWriteAccess(true, forRoleWithName:"Moderators")
var wallPost = PFObject(className: "WallPost")
var postACL = PFACL()
postACL.setWriteAccess(true, forRoleWithName: "Moderators")
wallPost.ACL = postACL
wallPost.saveInBackground()
```
Expand All @@ -123,13 +123,13 @@ PFACL *defaultACL = [PFACL ACL];
[PFACL setDefaultACL:defaultACL withAccessForCurrentUser:YES];
```
```swift
var defaultACL = PFACL.ACL()
var defaultACL = PFACL()
// Everybody can read objects created by this user
defaultACL.setPublicReadAccess(true)
defaultACL.hasPublicWriteAccess = true
// Moderators can also modify these objects
defaultACL.setWriteAccess(true, forRoleWithName:"Moderators")
defaultACL.setWriteAccess(true, forRoleWithName: "Moderators")
// And the user can read and modify its own objects
PFACL.setDefaultACL(defaultACL, withAccessForCurrentUser:true)
PFACL.setDefault(defaultACL, withAccessForCurrentUser:true)
```
</div>

Expand Down