任何人都不允许通过商店模式直接创建 只有管理员可以通过用户/ ID /商店
创建商店通过使用ACL,我拒绝在商店模型中创建细节。但我不知道如何通过管理员创建商店
$source = "F:\pics\2016\071310"
$destination = "C:\test"
$folder = "K-G\"
$filterKG = [regex] "^K-G.*\.(jpg|gif)"
$bin = Get-ChildItem -Exclude $folder -Path $source -Recurse | Where-Object {($_.Name -match $filterKG) -or ($_.PSIsContainer)}
foreach ($item in $bin){
$new_folder = $item.FullName.ToString().Replace($source,$destination).Replace($item.Name,$folder)
if(-not (Test-Path $new_folder)){
New-Item -Type dir $new_folder
Write-Host $new_folder
}
Copy-Item $item.FullName -Destination $item.FullName.ToString().Replace($source,$destination).Replace($item.Name,$folder+$item.Name)
}
#remove empty folders which where added
$tdc="C:\test"
do {
$dirs = gci $tdc -directory -recurse | Where { (gci $_.fullName -Force).count -eq 0 } | select -expandproperty FullName
$dirs | Foreach-Object { Remove-Item $_ }
} while ($dirs.count -gt 0)
提前致谢
这是我的script.js,
"acls": [
{
"principalType": "USER",
"principalId": "admin",
"permission": "ALLOW",
"property": "create"
},
{
"principalType": "ROLE",
"principalId": "$everyone",
"permission": "DENY",
"property": "create"
}
]
但我仍然收到授权错误
答案 0 :(得分:0)
如果您希望能够通过Shop
模型(User
)创建POST /users/{id}/shops
作为管理员,则还需要在User
上设置正确的ACL。我假设您正确设置了这两个模型之间的关系,并且您已经创建了管理员角色。
user.json(相关部分)
"acls": [
{
"accessType": "WRITE",
"principalType": "ROLE",
"principalId": "admin",
"permission": "ALLOW",
"property": [ "__create__shops" ]
}
]
您可以在官方LoopBack docs中找到更多相关信息。