Re: Authentication only for non admin login.
Re: Authentication only for non admin login.
- Subject: Re: Authentication only for non admin login.
- From: "Gary L. Wade" <email@hidden>
- Date: Fri, 18 Jul 2008 11:33:29 -0400
If you have already gotten an AuthorizationRef that's been authenticated, you can "copy info" from it that holds the "Username" (see the related documentation for those keywords). If you want the Unix username, start with "getuid" and work from there.
>hi,
>I think I have precisely mentioned what I want to do in the first 2 lines of
>my previous post. To add to it my current implementation is asking for a
>user name and password for admin as well as standard user login i want it to
>ask for a user name and password only for and only for standard user login.
>
>Can anyone tell me a way to identify which user(root/admin/standard) has
>logged?
>
>On Fri, Jul 18, 2008 at 12:35 AM, Mike <email@hidden>
>wrote:
>
>> No one is going to help you if you don't describe exactly what it is you
>> are trying to do. Authentication is a very difficult subject on OS X.
>> Without a concise, clear explanation, you're not going to get any help.
>>
>> ninad walvekar wrote:
>>
>>> hi,
>>>
>>> I want to run an application such that it will pop-up for the admin user
>>> name and password(authentication) when run by nonadmin (standard )login.
>>>
>>> let me explain what i am doing:-
>>> - (BOOL)Authenticate {
>>>
>>> AuthorizationRights myRights;
>>> AuthorizationItem myItems[1];
>>> AuthorizationRef authorizationRef;
>>> OSStatus err;
>>> AuthorizationFlags authFlags =
>>> kAuthorizationFlagInteractionAllowed | kAuthorizationFlagExtendRights;
>>> BOOL bRet;
>>>
>>> myItems[0].name = kAuthorizationRightExecute;
>>> myItems[0].valueLength = 0;
>>> myItems[0].value = NULL;
>>> myItems[0].flags = 0;
>>>
>>> char * rmArgs[2];
>>> // int status;
>>>
>>> rmArgs[0] = "-l";
>>> rmArgs[1] = NULL;
>>> // rmArgs[2] = NULL;
>>>
>>>
>>> myRights.count = sizeof(myItems) / sizeof(myItems[0]);
>>> myRights.items = myItems;
>>>
>>>
>>> err = AuthorizationCreate(&myRights, kAuthorizationEmptyEnvironment,
>>> authFlags, &authorizationRef);
>>>
>>> return bRet;
>>>
>>> }
>>> Can anyone tell the required modification so that i can make it work the
>>> way
>>> mentioned above or some other way by which i can achieve the needful.
>>>
>>> thanks in advance
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden