Inedo Community Forums Forums
    • Recent
    • Tags
    • Popular
    • Login

    Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

    If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

    Setting API key permissions

    Scheduled Pinned Locked Moved Support
    8 Posts 3 Posters 26 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F Offline
      forbzie22_0253
      last edited by forbzie22_0253

      Hi,

      I have been able to successfully set the permissions for an Admin API keys that has full system access by using the stored proc 'ApiKeys_CreateOrUpdateApiKey'

      I am using the same method to create an API key which needs to be able to publish packages to all feeds, can you tell me how the XML should be set?

      This works for my Admin System API key

      '<Inedo.ProGet.ApiKeys.ApiKey Assembly="ProGetCoreEx">' +
      '<Properties ' +
      'AllowPackagePromotionApi="False" ' +
      'AllowRepackagingApi="False" ' +
      'AllowFeedManagementApi="False" ' +
      'AllowWebhooksApi="True" ' +
      'AllowConnectorHealthApi="True" ' +
      'AllowFeedsApi="True" ' +
      'AllowDockerBlobReaderApi="False" ' +
      'AllowSbomApi="True" ' +
      'AllowSbomUpload="True" ' +
      'UseApiKeyTasks="False" ' +
      'AllowNativeApi="True" ' +
      'DoNotLogRequest="False" ' +
      'DoNotLogResponse="False" />' +
      '</Inedo.ProGet.ApiKeys.ApiKey>'

      This adds the api Key but gives me no permissions, the check box to 'Add/Repackage' is not getting checked.
      I want to give the API key access to Add/Repackage on all feeds
      I am using this XML:

      '<Inedo.ProGet.ApiKeys.ApiKey Assembly="ProGetCoreEx">' +
      '<Properties ' +
      'AllowPackagePromotionApi="False" ' +
      'AllowRepackagingApi="False" ' +
      'AllowFeedManagementApi="False" ' +
      'AllowWebhooksApi="False" ' +
      'AllowConnectorHealthApi="False" ' +
      'AllowFeedsApi="False" ' +
      'AllowDockerBlobReaderApi="False" ' +
      'AllowSbomApi="False" ' +
      'AllowSbomUpload="False" ' +
      'UseApiKeyTasks="True" ' +
      'AllowNativeApi="False" ' +
      'DoNotLogRequest="False" ' +
      'DoNotLogResponse="False" />' +
      '</Inedo.ProGet.ApiKeys.ApiKey>'

      Are there any docs that explain these permissions or are you able to help me to see where I am going wrong?

      thanks

      atrippA 1 Reply Last reply Reply Quote 0
      • atrippA Offline
        atripp inedo-engineer @forbzie22_0253
        last edited by

        Hi @forbzie22_0253,

        We don't document the specifics of the Native API, so I'm not sure. Your best bet is to study the underlying Stored Procedure and see what's going on there - that's something we do when needing to use the methods.

        That said, this Native API methods have been removed in ProGet 2024 in favor of Create ApiKey:
        https://docs.inedo.com/docs/proget-api-apikeys-create

        Best,

        Alana

        1 Reply Last reply Reply Quote 0
        • F Offline
          forbzie22_0253
          last edited by

          Thanks I will take a look at the latest version.

          Do Inedo recommend using pgutil instead of the usual HTTP APIs going forward?

          Will their be feature parity between the API and pgutil ?

          Just wondering what we should be using as the best way to programmatically manage ProGet going forward.

          Thanks

          atrippA 1 Reply Last reply Reply Quote 0
          • atrippA Offline
            atripp inedo-engineer @forbzie22_0253
            last edited by

            Hi @forbzie22_0253 ,

            Some of this is discussed on some recently published docs, but let me summarize some key points.

            In general, we recommend using pgutil for programmatic access to ProGet, but HTTP Endpoints may be more appropriate for working with structured data an advanced integration.

            If you're using .NET/C#, you may find the Inedo.ProGet library helpful:
            https://docs.inedo.com/docs/proget-reference-api#net-library-nuget-package

            Overall, we are working towards aligning our HTTP Endpoints and developing new ones using a pgutil-first approach. This means we will prioritize the CLI experience by creating intuitive and self-documenting commands. Then we will use existing HTTP Endpoints and develop new ones to fit those commands.

            Thanks,
            Alana

            1 Reply Last reply Reply Quote 0
            • J Offline
              jforbes_8292
              last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • F Offline
                forbzie22_0253
                last edited by

                Hi,

                I am using the new Create Api key API here: https://github.com/Inedo/pgutil/blob/thousand/Inedo.ProGet/ApiKeyInfo.cs

                /api/api-keys/create

                When I use Invoke-RestMethod against this new API it returns the error: Invoke-RestMethod : Required property missing: feedPermissions

                When checking the ApiKeyInfo.cs there is no property called 'feedPermissions' ?

                I also tried packagePermissions as thats the property in the .cs file but no joy.

                I am using Proget version 24.0.6.6

                1 Reply Last reply Reply Quote 0
                • atrippA Offline
                  atripp inedo-engineer
                  last edited by

                  Hi @forbzie22_0253

                  The error is incorrect; should say Required property missing: packagePermissions.

                  Since we don't document that one very well yet, I'd make sure it works with pgutil., and consider capturing traffic. Then, if you have an example we can post on the docs page, happy to add that to the docs.

                  Here is the client code as an FYI:
                  https://github.com/Inedo/pgutil/blob/thousand/pgutil/ApiKeys/Create/FeedCommand.cs

                  Thanks,
                  Alana

                  F 1 Reply Last reply Reply Quote 0
                  • F Offline
                    forbzie22_0253 @atripp
                    last edited by

                    @atripp thanks, resolved now.

                    1 Reply Last reply Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • 1 / 1
                    • First post
                      Last post
                    Inedo Website Home • Support Home • Code of Conduct • Forums Guide • Documentation