view dstep/coreservices/osservices/CSIdentity.d @ 11:07194b026fa4

Added bindings to a couple of frameworks, new license + some other things
author Jacob Carlborg <doob@me.com>
date Sat, 01 Aug 2009 15:03:28 +0200
parents
children
line wrap: on
line source

/**
 * Copyright: Copyright (c) 2009 Jacob Carlborg.
 * Authors: Jacob Carlborg
 * Version: Initial created: Jul 22, 2009 
 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
 */
module dstep.coreservices.osservices.CSIdentity;

//import dstep.AvailabilityMacros;
import dstep.corefoundation.CoreFoundation;
import dstep.coreservices.osservices.CSIdentityAuthority;
import dstep.security.Authorization;
import dstep.security.SecBase;
//import dstep.sys.types;

struct __CSIdentity;
struct __CSIdentityQuery;

alias __CSIdentity* CSIdentityRef;
alias __CSIdentityQuery* CSIdentityQueryRef;
alias int CSIdentityClass;
alias uint CSIdentityFlags;

extern (C)
{
	alias void function (CSIdentityRef, int, CFErrorRef, void*) CSIdentityStatusUpdatedCallback;
}

extern (C)
{
	extern
	{
		const CFStringRef kCSIdentityErrorDomain;
		const CFStringRef kCSIdentityGeneratePosixName;
	}
}

enum
{
	kCSIdentityUnknownAuthorityErr = -1,
	kCSIdentityAuthorityNotAccessibleErr = -2,
	kCSIdentityPermissionErr = -3,
	kCSIdentityDeletedErr = -4,
	kCSIdentityInvalidFullNameErr = -5,
	kCSIdentityDuplicateFullNameErr = -6,
	kCSIdentityInvalidPosixNameErr = -7,
	kCSIdentityDuplicatePosixNameErr = -8
}

enum
{
	kCSIdentityClassUser = 1,
	kCSIdentityClassGroup = 2
}

enum
{
	kCSIdentityFlagNone = 0,
	kCSIdentityFlagHidden = 1
}

enum
{
	kCSIdentityCommitCompleted = 1
}

struct CSIdentityClientContext
{
	int version_;
	void* info;
	CFAllocatorRetainCallBack retain;
	CFAllocatorReleaseCallBack release;
	CFAllocatorCopyDescriptionCallBack copyDescription;
	CSIdentityStatusUpdatedCallback statusUpdated;
}

extern (C)
{
	uint CSIdentityGetTypeID ();
	CSIdentityRef CSIdentityCreate (CFAllocatorRef allocator, int identityClass, CFStringRef fullName, CFStringRef posixName, uint flags, CSIdentityAuthorityRef authority);
	CSIdentityRef CSIdentityCreateCopy (CFAllocatorRef allocator, CSIdentityRef identity);
	int CSIdentityGetClass (CSIdentityRef identity);
	CSIdentityAuthorityRef CSIdentityGetAuthority (CSIdentityRef identity);
	CFUUIDRef CSIdentityGetUUID (CSIdentityRef identity);
	CFStringRef CSIdentityGetFullName (CSIdentityRef identity);
	uint CSIdentityGetPosixID (CSIdentityRef identity);
	CFStringRef CSIdentityGetPosixName (CSIdentityRef identity);
	CFStringRef CSIdentityGetEmailAddress (CSIdentityRef identity);
	CFURLRef CSIdentityGetImageURL (CSIdentityRef identity);
	CFDataRef CSIdentityGetImageData (CSIdentityRef identity);
	CFStringRef CSIdentityGetImageDataType (CSIdentityRef identity);
	CFArrayRef CSIdentityGetAliases (CSIdentityRef identity);
	ubyte CSIdentityIsMemberOfGroup (CSIdentityRef identity, CSIdentityRef group);
	ubyte CSIdentityIsHidden (CSIdentityRef identity);
	CFDataRef CSIdentityCreatePersistentReference (CFAllocatorRef allocator, CSIdentityRef identity);
	ubyte CSIdentityIsEnabled (CSIdentityRef user);
	ubyte CSIdentityAuthenticateUsingPassword (CSIdentityRef user, CFStringRef password);
	SecCertificateRef CSIdentityGetCertificate (CSIdentityRef user);
	CSIdentityQueryRef CSIdentityCreateGroupMembershipQuery (CFAllocatorRef allocator, CSIdentityRef group);
	void CSIdentitySetFullName (CSIdentityRef identity, CFStringRef fullName);
	void CSIdentitySetEmailAddress (CSIdentityRef identity, CFStringRef emailAddress);
	void CSIdentitySetImageURL (CSIdentityRef identity, CFURLRef url);
	void CSIdentitySetImageData (CSIdentityRef identity, CFDataRef imageData, CFStringRef imageDataType);
	void CSIdentityAddAlias (CSIdentityRef identity, CFStringRef alias_);
	void CSIdentityRemoveAlias (CSIdentityRef identity, CFStringRef alias_);
	void CSIdentityAddMember (CSIdentityRef group, CSIdentityRef member);
	void CSIdentityRemoveMember (CSIdentityRef group, CSIdentityRef member);
	void CSIdentitySetIsEnabled (CSIdentityRef user, ubyte isEnabled);
	void CSIdentitySetPassword (CSIdentityRef user, CFStringRef password);
	void CSIdentitySetCertificate (CSIdentityRef user, SecCertificateRef certificate);
	void CSIdentityDelete (CSIdentityRef identity);
	ubyte CSIdentityCommit (CSIdentityRef identity, AuthorizationRef authorization, CFErrorRef* error);
	ubyte CSIdentityCommitAsynchronously (CSIdentityRef identity, CSIdentityClientContext* clientContext, CFRunLoopRef runLoop, CFStringRef runLoopMode, AuthorizationRef authorization);
	ubyte CSIdentityIsCommitting (CSIdentityRef identity);
	void CSIdentityRemoveClient (CSIdentityRef identity);
}