Skip to content

Commit 2dcb597

Browse files
author
Roman Perehod
committed
Fields of CasbinRule were extended
1 parent 6d28ef8 commit 2dcb597

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

adapter.go

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ type CasbinRule struct {
3232
V3 string `xorm:"varchar(100) index"`
3333
V4 string `xorm:"varchar(100) index"`
3434
V5 string `xorm:"varchar(100) index"`
35+
V6 string `xorm:"varchar(100) index"`
36+
V7 string `xorm:"varchar(100) index"`
37+
V8 string `xorm:"varchar(100) index"`
38+
V9 string `xorm:"varchar(100) index"`
3539
}
3640

3741
// Adapter represents the Xorm adapter for policy storage.
@@ -168,6 +172,18 @@ func loadPolicyLine(line CasbinRule, model model.Model) {
168172
if line.V5 != "" {
169173
lineText += ", " + line.V5
170174
}
175+
if line.V6 != "" {
176+
lineText += ", " + line.V6
177+
}
178+
if line.V7 != "" {
179+
lineText += ", " + line.V7
180+
}
181+
if line.V8 != "" {
182+
lineText += ", " + line.V8
183+
}
184+
if line.V9 != "" {
185+
lineText += ", " + line.V9
186+
}
171187

172188
persist.LoadPolicyLine(lineText, model)
173189
}
@@ -209,6 +225,18 @@ func savePolicyLine(ptype string, rule []string) CasbinRule {
209225
if len(rule) > 5 {
210226
line.V5 = rule[5]
211227
}
228+
if len(rule) > 6 {
229+
line.V6 = rule[6]
230+
}
231+
if len(rule) > 7 {
232+
line.V7 = rule[7]
233+
}
234+
if len(rule) > 8 {
235+
line.V8 = rule[8]
236+
}
237+
if len(rule) > 9 {
238+
line.V9 = rule[9]
239+
}
212240

213241
return line
214242
}

0 commit comments

Comments
 (0)