Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dapphub/ds-auth
Updatable, unobtrusive Solidity authorization pattern
https://github.com/dapphub/ds-auth
authorization dappsys ethereum solidity
Last synced: about 22 hours ago
JSON representation
Updatable, unobtrusive Solidity authorization pattern
- Host: GitHub
- URL: https://github.com/dapphub/ds-auth
- Owner: dapphub
- License: gpl-3.0
- Created: 2016-08-04T16:05:46.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2022-08-28T01:57:30.000Z (about 2 years ago)
- Last Synced: 2023-11-07T16:09:16.801Z (about 1 year ago)
- Topics: authorization, dappsys, ethereum, solidity
- Language: Solidity
- Homepage: https://dapp.tools/dappsys/ds-auth.html
- Size: 83 KB
- Stars: 138
- Watchers: 13
- Forks: 43
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
DSAuth
_Fully updatable unobtrusive auth_
Provides a flexible and updatable auth pattern which is completely separate
from application logic. By default, the `auth` modifier will restrict
function-call access to the including contract owner and the including
contract itself.In addition, fine-grained function access can be controlled by specifying an
`authority` - a contract which implements the `DSAuthority` interface to define
custom access permissions.Dappsys provides a couple of ready-made authority contracts,
[ds-guard](https://dapp.tools/dappsys/ds-guard.html) and
[ds-roles](https://dapp.tools/dappsys/ds-roles.html), which can be used as
authorities where updatable fine-grained permissioned auth is required.### Usage
The `auth` **modifier** provided by DSAuth triggers the internal `isAuthorized`
function to require that the `msg.sender` is authorized ie. the sender is either:1. the contract `owner`;
2. the contract itself;
3. or has been granted permission via a specified `authority`.```solidity
function myProtectedFunction() auth {}
```### API
#### `setOwner(address owner_)`
Set a new `owner` (requires auth)#### `setAuthority(DSAuthority authority_)`
Set a new `authority` (requires auth)