在非管理员 Mac 上更改 RealBASIC 权限
我的应用程序需要将文件写入(并移动)到非管理员用户的文件夹中,并且该用户无权使用该文件夹。
我尝试更改该文件夹的权限,但似乎没有效果。
是否存在允许我这样做的内置限制?
我所做的就是写入文档,然后尝试将文件移动到最终文件夹,但失败了......
感谢您的回答!
这是代码:
Dim t as TextOutputStream
Dim tempfile as FolderItem = SpecialFolder.Documents.Child(filePath.Name)
t = tempfile.CreateTextFile
t.Write fileData
t.close
Dim p as New Permissions( 0 )
p.OthersExecute = True
p.OthersWrite = True
p.OthersRead = True
filePath.Parent.Permissions = p
tempfile.MoveFileTo filePath.Parent
My app needs to write (and move) files to a folder from a non-admin user, and that user has no permission to use that folder.
I tried changing the permissions for the folder but it doesn't appear to have an effect.
Are there built-in restrictions from allowing me to do that?
What I do is write to Documents and then attempt to move file to final folder, which fails...
Thanks for any answers!
Here is the code:
Dim t as TextOutputStream
Dim tempfile as FolderItem = SpecialFolder.Documents.Child(filePath.Name)
t = tempfile.CreateTextFile
t.Write fileData
t.close
Dim p as New Permissions( 0 )
p.OthersExecute = True
p.OthersWrite = True
p.OthersRead = True
filePath.Parent.Permissions = p
tempfile.MoveFileTo filePath.Parent
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该操作系统旨在阻止此类事情,否则这是一个巨大的安全漏洞
The OS is designed to STOP this sort of thing as it's a huge security hole otherwise
您可以使用 Monkeybread Software 插件 AuthorizationMBS 中的功能之一来允许授权,假设用户可以提升安全级别。在我的一个必须进入系统位置的类中,我有这个:
该类具有以下属性:
mbsForm 作为字符串
mbsAuth 作为 AuthorizationMBS
You could use one of the functions in the Monkeybread Software plugin, AuthorizationMBS, to allow authorization, assuming the user can elevate the security level. In a class of mine that has to get into a System location, I have this:
The class has these properties:
mbsForm as string
mbsAuth as AuthorizationMBS