This repository was archived by the owner on May 25, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #218 from inrupt/release/0.5.1
Release/0.5.1
- Loading branch information
Showing
119 changed files
with
5,026 additions
and
2,617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import solid from 'solid-auth-client'; | ||
import * as parse from 'parse-link-header'; | ||
import AccessControlList from './access-control-list'; | ||
|
||
/** | ||
* This factory will create and return a new ACL object while also fetching the Link | ||
* Header and returning the acl file location | ||
*/ | ||
export default class ACLFactory { | ||
static createNewAcl = async (owner, documentUri) => { | ||
const aclUrl = await this.getAclUriFromHeader(documentUri); | ||
const aclUrlValidated = new URL(aclUrl, documentUri).href; | ||
return new AccessControlList(owner, documentUri, aclUrlValidated); | ||
}; | ||
|
||
static getAclUriFromHeader = async documentUri => { | ||
try { | ||
const response = await solid.fetch(documentUri, { method: 'HEAD' }); | ||
const parsedLinks = parse(response.headers.get('Link')); | ||
return parsedLinks.acl ? parsedLinks.acl.url : ''; | ||
} catch (error) { | ||
throw error; | ||
} | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import { Notification } from './notification'; | ||
import AccessControlList from './access-control-list'; | ||
import ACLFactory from './access-control-factory'; | ||
import AppPermission from './app-permissions'; | ||
|
||
export { Notification, AccessControlList, AppPermission }; | ||
export { Notification, AccessControlList, ACLFactory, AppPermission }; |
Oops, something went wrong.