• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Authentication only for non admin login.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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:44:57 -0400

Sorry, I didn't read your original post too carefully; it looks like you haven't even gotten to that point of authenticating.  Check for examples using SFAuthorizationView; it creates the OS-standard lock/unlock icon and label and can prompt the user in the way you want.

If you still need the username after that, see my first post.

>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

  • Prev by Date: Xcode style divider with embedded popup and pulldown menus
  • Next by Date: Dispatch NSEvent to everyone
  • Previous by thread: Re: Authentication only for non admin login.
  • Next by thread: How to programmatically open an NSComboBox's list?
  • Index(es):
    • Date
    • Thread