mirror of
https://github.com/fluencelabs/tendermint
synced 2025-06-27 19:51:41 +00:00
little fixes
This commit is contained in:
@ -63,6 +63,9 @@ func (p *BasePermissions) Get(ty PermFlag) (bool, error) {
|
|||||||
|
|
||||||
// Set a permission bit. Will set the permission's set bit to true.
|
// Set a permission bit. Will set the permission's set bit to true.
|
||||||
func (p *BasePermissions) Set(ty PermFlag, value bool) error {
|
func (p *BasePermissions) Set(ty PermFlag, value bool) error {
|
||||||
|
if ty == 0 {
|
||||||
|
return ErrInvalidPermission(ty)
|
||||||
|
}
|
||||||
p.SetBit |= ty
|
p.SetBit |= ty
|
||||||
if value {
|
if value {
|
||||||
p.Perms |= ty
|
p.Perms |= ty
|
||||||
@ -74,6 +77,9 @@ func (p *BasePermissions) Set(ty PermFlag, value bool) error {
|
|||||||
|
|
||||||
// Set the permission's set bit to false
|
// Set the permission's set bit to false
|
||||||
func (p *BasePermissions) Unset(ty PermFlag) error {
|
func (p *BasePermissions) Unset(ty PermFlag) error {
|
||||||
|
if ty == 0 {
|
||||||
|
return ErrInvalidPermission(ty)
|
||||||
|
}
|
||||||
p.SetBit &= ^ty
|
p.SetBit &= ^ty
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -61,6 +61,16 @@ x - unknown output, without create (fail)
|
|||||||
x - unknown output, with create (pass)
|
x - unknown output, with create (pass)
|
||||||
|
|
||||||
|
|
||||||
|
- SNative (CallTx, CALL):
|
||||||
|
- for each of CallTx, Call
|
||||||
|
x - call each snative without permission, fails
|
||||||
|
x - call each snative with permission, pass
|
||||||
|
- list:
|
||||||
|
x - base: has,set,unset
|
||||||
|
x - globals: set
|
||||||
|
x - roles: has, add, rm
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// keys
|
// keys
|
||||||
@ -786,17 +796,6 @@ func TestCreateAccountPermission(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
- SNative (CallTx, CALL):
|
|
||||||
- for each of CallTx, Call
|
|
||||||
- call each snative without permission, fails
|
|
||||||
- call each snative with permission, pass
|
|
||||||
- list:
|
|
||||||
- base: has,set,unset
|
|
||||||
- globals: set
|
|
||||||
- roles: has, add, r
|
|
||||||
*/
|
|
||||||
|
|
||||||
func TestSNativeCALL(t *testing.T) {
|
func TestSNativeCALL(t *testing.T) {
|
||||||
stateDB := dbm.GetDB("state")
|
stateDB := dbm.GetDB("state")
|
||||||
genDoc := newBaseGenDoc(PermsAllFalse, PermsAllFalse)
|
genDoc := newBaseGenDoc(PermsAllFalse, PermsAllFalse)
|
||||||
|
Reference in New Issue
Block a user