status-go/services/permissions/api.go

27 lines
548 B
Go
Raw Normal View History

package permissions
import (
"context"
)
2019-07-25 05:35:09 +00:00
func NewAPI(db *Database) *API {
return &API{db}
}
// API is class with methods available over RPC.
type API struct {
2019-07-25 05:35:09 +00:00
db *Database
}
func (api *API) AddDappPermissions(ctx context.Context, perms DappPermissions) error {
2019-07-25 05:35:09 +00:00
return api.db.AddPermissions(perms)
}
func (api *API) GetDappPermissions(ctx context.Context) ([]DappPermissions, error) {
2019-07-25 05:35:09 +00:00
return api.db.GetPermissions()
}
func (api *API) DeleteDappPermissions(ctx context.Context, name string) error {
2019-07-25 05:35:09 +00:00
return api.db.DeletePermission(name)
}