我試圖做一個環回的模型JS文件的查詢。這是非常簡單的,它如下: //isAdmin function: gets a boolean if a given userProfileId is an admin or not.
Userprofile.isAdmin = function(userProfileId, cb) {
let role = app.models.Rol
在添加用戶時添加與用戶對應的角色映射中的數據的最佳實踐是什麼? 1)在model-config中設置關係,是否會添加roleMapping數據? 2)在保存用戶鉤子後,需要手動添加roleMapping,就像這裏介紹的那樣:[Link] [1]。 [1]:Dynamically adding user to a loopback Role,象下面這樣: user.observe('after sa