|
@@ -46,17 +46,19 @@ func (this *Rbac) ToEachPage() error {
|
|
|
u := FindOne("user", "{'_id':'"+userId+"'}")
|
|
|
u_type := (*u)["i_type"]
|
|
|
if u_type == 0 {
|
|
|
- pids := util.ObjToString((*u)["s_power"])
|
|
|
- if len(strings.Split(pids, ",")) > 0 {
|
|
|
- var ids []bson.ObjectId
|
|
|
- for _, chid := range strings.Split(pids, ",") {
|
|
|
- ids = append(ids, bson.ObjectIdHex(chid))
|
|
|
- }
|
|
|
- resultMap = Find("catalog", bson.M{"_id": bson.M{"$in": ids}}, nil, nil, false, -1, -1)
|
|
|
- }
|
|
|
firstUrl := "/"
|
|
|
- if len(*resultMap) > 0 {
|
|
|
- firstUrl = util.ObjToString((*resultMap)[0]["s_url"])
|
|
|
+ if (*u)["s_power"] != nil {
|
|
|
+ pids := util.ObjToString((*u)["s_power"])
|
|
|
+ if len(strings.Split(pids, ",")) > 0 {
|
|
|
+ var ids []bson.ObjectId
|
|
|
+ for _, chid := range strings.Split(pids, ",") {
|
|
|
+ ids = append(ids, bson.ObjectIdHex(chid))
|
|
|
+ }
|
|
|
+ resultMap = Find("catalog", bson.M{"_id": bson.M{"$in": ids}}, nil, nil, false, -1, -1)
|
|
|
+ }
|
|
|
+ if len(*resultMap) > 0 {
|
|
|
+ firstUrl = util.ObjToString((*resultMap)[0]["s_url"])
|
|
|
+ }
|
|
|
}
|
|
|
return this.Redirect(firstUrl)
|
|
|
} else if u_type == -1 {
|