Function

CFFileSecuritySetAccessControlList(_:_:)

Sets the access control list associated with a CFFileSecurityRef object.

Declaration

func CFFileSecuritySetAccessControlList(_ fileSec: CFFileSecurity!, _ accessControlList: acl_t!) -> Bool

Parameters

fileSec

The CFFileSecurityRef object to modify.

accessControlList

The access control list to set, or kCFFileSecurityRemoveACL to indicate that the access control list should be removed from a file, or NULL to unset the access control list property in the object.

Return Value

Returns true if the access control list was successfully set, or false otherwise.

Discussion

To remove the access control list from a file system object, pass kCFFileSecurityRemoveACL as the accessControlList parameter. Then, call CFURLSetResourcePropertyForKey(_:_:_:_:) to set kCFURLFileSecurityKey to the resulting fileSec object.

Setting the accessControlList to NULL unsets the ACL property of the CFFileSecurityRef object. By doing this, the access control list of the file will be unchanged if you subsequently use this object to set permissions on an actual file system object.