我有一个文件夹权限列表,我想测试此列表中的每个IdentityReference是否存在于由IdentityReferences组成的另一个列表中,如果匹配则不执行任何操作,否则删除此IdentityReference的权限。
请记住,以上只是为了描述我的目标,我已经有了一个正常工作的代码,但问题是它是10行,我想用最少的行数来完成。
Route::get('/showQualityResult', 'QualityCheckController@showQualityResult');
现在我必须将一个用户定义的函数应用于$ perm中的每个IdentityReference,这可以在一行中完成吗?
答案 0 :(得分:2)
试试这个
$perm = $acl.Access | select IdentityReference, FileSystemRights | where {$_.IdentityReference -notin @("BUILTIN\Administrators", "NT AUTHORITY\SYSTEM")}
$perm | %{yourfunction $_.IdentityReference}
或在同一行
$acl.Access | select IdentityReference, FileSystemRights | where {$_.IdentityReference -notin @("BUILTIN\Administrators", "NT AUTHORITY\SYSTEM")} | %{yourfunction $_.IdentityReference}