FROM : Simon Stapleton
DATE : Sat Oct 05 18:36:15 2002
On Friday, October 4, 2002, at 10:12 pm, Ben Mackin wrote:
> Ok, then what I will do is disable the option to switch if they are
> not the
> admin. How does one check if the current user has admin privileges, or
> if
> they are a "normal" user?
Wrong question. The question is not 'are they admin?', or even 'do
they have admin priviledges?', but 'are they able they carry out the
modification we want to do?'. And to do this, you'll want something
like:
NSString * plistPath = nil;
BOOL isPlistWritable = NO;
if (plistPath = [[NSBundle mainBundle] pathForResource:@"Info"
ofType:@"plist"]) {
isPlistWritable = [[NSFileManager defaultManager]
isFileWritableAtPath:plistPath];
}
// Now check isPlistWritable and carry out the appropriate actions.
Hope that helps
Simon
--
PGP Key Id : 0x50D0698D
--
Your mouse has moved. You must restart Windows NT for this change to
be recognised.
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
DATE : Sat Oct 05 18:36:15 2002
On Friday, October 4, 2002, at 10:12 pm, Ben Mackin wrote:
> Ok, then what I will do is disable the option to switch if they are
> not the
> admin. How does one check if the current user has admin privileges, or
> if
> they are a "normal" user?
Wrong question. The question is not 'are they admin?', or even 'do
they have admin priviledges?', but 'are they able they carry out the
modification we want to do?'. And to do this, you'll want something
like:
NSString * plistPath = nil;
BOOL isPlistWritable = NO;
if (plistPath = [[NSBundle mainBundle] pathForResource:@"Info"
ofType:@"plist"]) {
isPlistWritable = [[NSFileManager defaultManager]
isFileWritableAtPath:plistPath];
}
// Now check isPlistWritable and carry out the appropriate actions.
Hope that helps
Simon
--
PGP Key Id : 0x50D0698D
--
Your mouse has moved. You must restart Windows NT for this change to
be recognised.
_______________________________________________
cocoa-dev mailing list | <email_removed>
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
| Related mails | Author | Date |
|---|---|---|
| Ben Mackin | Oct 3, 21:38 | |
| Olivier | Oct 3, 23:01 | |
| Ben Mackin | Oct 4, 01:04 | |
| Thomas Castiglione | Oct 4, 15:40 | |
| Finlay Dobbie | Oct 4, 22:57 | |
| Ben Mackin | Oct 4, 23:12 | |
| Charles Srstka | Oct 4, 23:29 | |
| Finlay Dobbie | Oct 5, 00:02 | |
| Simon Stapleton | Oct 5, 18:36 |






Cocoa mail archive

