status-go/services/permissions/api.go

31 lines
714 B
Go
Raw Permalink 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 {
return api.db.DeletePermission(name, "")
}
func (api *API) DeleteDappPermissionsByNameAndAddress(ctx context.Context, name string, address string) error {
return api.db.DeletePermission(name, address)
}