Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/Permission test


Required plugins for this example: MBS MacOSX Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/Permission test

This example is the version from Tue, 30th Dec 2013.

Project "Permission test.xojo_binary_project"
FileTypes
Filetype special/any
End FileTypes
Class Window1 Inherits Window
Control StaticText2 Inherits Label
ControlInstance StaticText2 Inherits Label
End Control
Control StaticText3 Inherits Label
ControlInstance StaticText3 Inherits Label
End Control
Control filename Inherits Label
ControlInstance filename Inherits Label
End Control
Control userid Inherits Label
ControlInstance userid Inherits Label
End Control
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
Control groupid Inherits Label
ControlInstance groupid Inherits Label
End Control
Control StaticText7 Inherits Label
ControlInstance StaticText7 Inherits Label
End Control
Control AMode Inherits Label
ControlInstance AMode Inherits Label
End Control
Control UserPrivilegesStr Inherits Label
ControlInstance UserPrivilegesStr Inherits Label
End Control
Control UMode Inherits Label
ControlInstance UMode Inherits Label
End Control
Control StaticText71 Inherits Label
ControlInstance StaticText71 Inherits Label
End Control
EventHandler Sub DropObject(obj As DragItem, action As Integer) do if obj.folderItemavailable then run obj.folderItem end if loop until not obj.nextItem End EventHandler
EventHandler Sub Open() me.acceptfileDrop "special/any" End EventHandler
Sub run(f as folderItem) dim p as PermissionsMBS dim s as string dim m as integer // using older APIs for older Mac Access rights filename.text=f.displayName p=f.PermissionsMBS(true) if p=nil then userid.text="" groupid.text="" amode.text="" UserPrivilegesStr.text="" else userid.text=hex(p.userID) groupid.text=hex(p.groupID) m=p.access amode.text=hex(m) s="User: " if bitwiseand(m,&h02000000)=0 then s=s+"no read, " else s=s+"read, " end if if bitwiseand(m,&h04000000)=0 then s=s+"no write, " else s=s+"write, " end if if bitwiseand(m,&h01000000)=0 then s=s+"no search." else s=s+"search." end if s=s+chr(13)+"Group: " if bitwiseand(m,&h00000200)=0 then s=s+"no read, " else s=s+"read, " end if if bitwiseand(m,&h00000400)=0 then s=s+"no write, " else s=s+"write, " end if if bitwiseand(m,&h00000100)=0 then s=s+"no search." else s=s+"search." end if s=s+chr(13)+"Everyone: " if bitwiseand(m,&h00020000)=0 then s=s+"no read, " else s=s+"read, " end if if bitwiseand(m,&h00040000)=0 then s=s+"no write, " else s=s+"write, " end if if bitwiseand(m,&h00010000)=0 then s=s+"no search." else s=s+"search." end if s=s+chr(13)+"Owner: " if bitwiseand(m,&h00000002)=0 then s=s+"no read, " else s=s+"read, " end if if bitwiseand(m,&h00000004)=0 then s=s+"no write, " else s=s+"write, " end if if bitwiseand(m,&h00000001)=0 then s=s+"no search." else s=s+"search." end if UserPrivilegesStr.text=s end if // using newer APIs for getting mode p=f.PermissionsMBS(false) if p=nil then umode.text="" else umode.text=oct(p.Mode) end if End Sub
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

The items on this page are in the following plugins: MBS MacOSX Plugin.


The biggest plugin in space...