forked from ebhomengo/niki
fix(niki): refactor `replace pkg/slice with std/slices`
This commit is contained in:
parent
4eadf98c2e
commit
caf564d474
|
@ -1,15 +0,0 @@
|
|||
package slice
|
||||
|
||||
import (
|
||||
"git.gocasts.ir/ebhomengo/niki/entity"
|
||||
)
|
||||
|
||||
func DoesExist(list []entity.AdminPermission, value entity.AdminPermission) bool {
|
||||
for _, item := range list {
|
||||
if item == value {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
|
@ -1,12 +1,12 @@
|
|||
package mysqladmin
|
||||
|
||||
import (
|
||||
"slices"
|
||||
"time"
|
||||
|
||||
"git.gocasts.ir/ebhomengo/niki/entity"
|
||||
errmsg "git.gocasts.ir/ebhomengo/niki/pkg/err_msg"
|
||||
richerror "git.gocasts.ir/ebhomengo/niki/pkg/rich_error"
|
||||
"git.gocasts.ir/ebhomengo/niki/pkg/slice"
|
||||
"git.gocasts.ir/ebhomengo/niki/repository/mysql"
|
||||
)
|
||||
|
||||
|
@ -70,12 +70,12 @@ func (d *DB) GetAdminPermissions(adminID uint, role entity.AdminRole) ([]entity.
|
|||
// merge ACLs by permission
|
||||
adminPermissions := make([]entity.AdminPermission, 0)
|
||||
for _, r := range adminRoleACL {
|
||||
if !slice.DoesExist(adminPermissions, r.Permission) {
|
||||
if !slices.Contains(adminPermissions, r.Permission) {
|
||||
adminPermissions = append(adminPermissions, r.Permission)
|
||||
}
|
||||
}
|
||||
for _, a := range adminACL {
|
||||
if !slice.DoesExist(adminPermissions, a.Permission) {
|
||||
if !slices.Contains(adminPermissions, a.Permission) {
|
||||
adminPermissions = append(adminPermissions, a.Permission)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue