upd(internal): rules.value as tinyint
This commit is contained in:
committed by
Tit Petric
parent
578363d8f8
commit
d9761cb7a1
@@ -11,12 +11,12 @@ import (
|
||||
"github.com/crusttech/crust/system/types"
|
||||
)
|
||||
|
||||
type Access string
|
||||
type Access int
|
||||
|
||||
const (
|
||||
Allow Access = "yes"
|
||||
Deny = "no"
|
||||
Inherit = ""
|
||||
Allow Access = 1
|
||||
Deny = 0
|
||||
Inherit = -1
|
||||
)
|
||||
|
||||
type resources struct {
|
||||
@@ -104,8 +104,9 @@ func (r *resources) Grant(resource string, teamID uint64, operations []string, v
|
||||
row := types.Rules{
|
||||
TeamID: teamID,
|
||||
Resource: resource,
|
||||
Value: string(value),
|
||||
Value: int(value),
|
||||
}
|
||||
|
||||
var err error
|
||||
for _, operation := range operations {
|
||||
row.Operation = operation
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,7 +2,7 @@ CREATE TABLE `sys_rules` (
|
||||
`rel_team` BIGINT UNSIGNED NOT NULL,
|
||||
`resource` VARCHAR(128) NOT NULL,
|
||||
`operation` VARCHAR(128) NOT NULL,
|
||||
`value` ENUM('no', 'yes') NOT NULL,
|
||||
`value` TINYINT(1) NOT NULL,
|
||||
|
||||
PRIMARY KEY (`rel_team`, `resource`, `operation`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
@@ -4,5 +4,5 @@ type Rules struct {
|
||||
TeamID uint64 `db:"rel_team"`
|
||||
Resource string `db:"resource"`
|
||||
Operation string `db:"operation"`
|
||||
Value string `db:"value"`
|
||||
Value int `db:"value"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user