permissions – POST Product Image w/ REST API Exception

I have Magento running in a Bitnami Docker container, and
trying to upload an image for a product using the REST API causes an exception.

I initially suspected a permissions error, so the following subdirectories of the Magento installation are CHMOD 777:

Please note I’ve removed the base64 encoded image data from the code snippet below in order to keep this post short and readable.

Not sure what else to look for – a config option maybe?.
Any pointers in the right direction appreciated.

Data I’m sending to server:

{
    "entry": {
        "content": {
            "base64_encoded_data": ***(IMAGE DATA SUPPLIED HERE, NOT SHOWN)***,
            "name": "Mizuno-2.jpg",
            "type": "image/jpeg"
        },
        "disabled": false,
        "file": "Mizuno-2.jpg",
        "id": 0,
        "label": "Mizuno 2",
        "media_type": "image",
        "position": 1,
        "types": (
            "image"
        )
    }
}

REST API Error:

2021-07-26:23:25:27,818 DEBUG    (connectionpool.py:0452) http://localhost:8080 "POST /rest/V1/products/Mizuno-2/media HTTP/1.1" 500 104
<Response (500)>
{
    "message": "Internal Error. Details are available in Magento log file. Report ID: webapi-60ff4467c74b8"
}

Server Log Exception Message:

(2021-07-26 23:25:27) main.CRITICAL: Report ID: webapi-60ff4467c74b8; Message: Notice: file_get_contents(): file created in the system's temporary directory in /bitnami/magento/vendor/laminas/laminas-http/src/PhpEnvironment/Request.php on line 96 {"exception":"(object) (Exception(code: 0): Report ID: webapi-60ff4467c74b8; Message: Notice: file_get_contents(): file created in the system's temporary directory in /bitnami/magento/vendor/laminas/laminas-http/src/PhpEnvironment/Request.php on line 96 at /bitnami/magento/vendor/magento/framework/Webapi/ErrorProcessor.php:208, Exception(code: 0): Notice: file_get_contents(): file created in the system's temporary directory in /bitnami/magento/vendor/laminas/laminas-http/src/PhpEnvironment/Request.php on line 96 at /bitnami/magento/vendor/magento/framework/App/ErrorHandler.php:61)"} ()

permissions – Newb issues: Connecting from C# Pnp.Framework to SPO

I’ve been away from SharePoint for 4-5 years and now need to migrate/upgrade an OnPrem site I created back then to SharePoint Online. The application involves a C# Widows Service that updates data in one List from external data, and adds items to another List. I quickly realized that the old code (using the Microsoft.SharePoint.Client.Latest Nuget package from 2016) doesn’t work with SharePoint Online, and that I should be using the PnP.Framwork Nuget package instead.

I created a tiny proof of concept app (code below), but cannot get the connection to work correctly. If I try using an App-only context, I get the following error: “System.Net.WebException: ‘The remote server returned and error: (403) Forbidden.'” I assume I need to do something to grant permissions to this application? (I don’t know where apps are granted permissions)

If I try to use a username and password, and use a user that has explicit permissions, I get the following: “Microsoft.Identity.Client.MsalUiRequiredException: ‘AADSTS65001: The user or administrator has not consented to use the application with ID ‘31359c7f-bd7e-475c-86db-fdb8c937548e’ named ‘PnP Management Shell’. Send an interactive authorization request for this user and resource.'” ( I do not pass in either that GUID or that application name) How do I consent for this user to connect from the PnP.Framework?

Proof of Concept Code :

        static void Main(string() args)
        {
            Console.WriteLine("Testing connections to SPOnline from code.");
            var url = Facts.SiteUrl;
            var user = Facts.SPOnlineUser;
            var password = Facts.SPPassword;
            var pswd = new SecureString();
            foreach (var ch in password)
                pswd.AppendChar(ch);
            //NOTE:  Uncomment below and comment out Username/Password code to switch to Application context
            //using (var cc = new AuthenticationManager().GetACSAppOnlyContext(siteUrl: url,
            //                                                                appId: Facts.ApplicationId,
            //                                                                appSecret: Facts.AppSecret))
            //pswd.AppendChar('%');//Makes the password wrong (for testing only)
            var am = new AuthenticationManager(user, pswd);
            using (var cc = am.GetContext(url))  //<-- Exception thrown here when using user context
            {
                var site = cc.Site;
                //cc.Load(site);
                var web = cc.Web;
                //cc.Load(web);
                var lists = web.Lists;
                cc.Load(lists);
                cc.ExecuteQuery(); //<-- Exception thrown here when using application context

                Console.WriteLine("Lists found:");
                foreach(var list in lists)
                {
                    Console.WriteLine("t" + list.Title);
                }
            }
        }

Image Permissions Plugin

I’m kicking around the idea of using wordpress for a future project but it’s going to need so many plugins I’m having doubts.

#1 requirement is that images are tied to a user/contributor and to a custom post. Anyone editing the custom post can see any images that have been uploaded. A user can see all their images regardless of which custom post they’re editing.

Does anyone know if a plugin that handles these file permissions?
SEMrush

 

Is it possible to limit permissions when using PnP PowerShell or SharePoint Online Management Shell to a user’s existing permissions?

I have Microsoft Teams team Owner permissions in Office 365 and all users in our organisation can create teams.

Many of my tasks involve introducing efficiencies using tools such as Power Automate, Term Store Management Tool, Site Columns, Managed Metadata Columns and custom SharePoint Lists and Document Libraries.

As I am an Owner, I can do quite a lot of things, however I do come up against constraints when I want to do further automation (or access data) that involves Graph or SharePoint API.

I have recently put in an IT request to have PnP PowerShell and SharePoint Online Management Shell installed.

If these tools are installed, do they enable me to do things that are only possible with my current set of permissions?

Or do they require elevating my permissions to another level?

Additionally, is it possible to ‘lock down’ the permissions to the Microsoft Teams instances that I am an Owner of, or does the ability to use these tools automatically grant you permissions over all resources at the tenant level?

To be honest, at this stage I would prefer my capabilities to be limited to what my current permissions allow, because although I have full-stack developer experience and am comfortable working with REST api’s, I am relatively new to managing things via PowerShell.

For context, I’ve also put in a request to register an Azure App so that I can access Microsoft Graph that way, but the request requires granular definition of the permissions I need and I am having difficulty anticipating all the possible permissions I will need (and i’m not sure if I can say ‘everything!’).

Manage permissions on library subfolder SharePoint 365

I’m using SharePoint form Microsoft 365

I have created site and added some members. I created a library on it, but I would like that only some persons have access to certain subfolders inside (not all site members). I have read about breaking inheritance, and granting excusive permissions on folders, but, as far as I can see, on 365 I can only do it at library level, not subfolder or item level.

Is there a way to perform this on 365, or using different libraries is the better (or even unique) approach to perform this?

Get sharepoint subsite permissions groups/user list

I would like to know who has the access to my sharepoint site using MS flow.
It can be granted the permission to a person or to a group

how do i get all information by using flow? any API ?

Group Permissions in SharePoint 2013

I have SP 2013 sites. I want to read the group on user.aspx page with permission level. But I am getting error on get permission. some one help me with this.

$SiteGroups = Get-PnPGroup 
 
Write-host "Total Number of Groups Found:"$SiteGroups.Count

ForEach($Group in $SiteGroups)
{
    $GName = $Group.Title
    $GID = $Group.Id

    $Role = Get-PnPGroupPermissions -Identity $Group.Title #I am getting error here
 }

SharePoint based run only permissions not available after adding a Power Automate to a solution

I noticed that when we have a Flow outside the solution it has the SharePoint based run only permissions available.

But once we add it to a solutions, it is no longer available

enter image description here

Is it possible to retain SharePoint based permissions even after adding the Power Automate to a solutions?

8 – User role permissions per language

Working code example:

use DrupalnodeNodeInterface;
use DrupalCoreSessionAccountInterface;
use DrupalCoreAccessAccessResult;

/**
 * Implements hook_node_access().
 *
 * Prevent editor role to edit and/or delete fr/en nodes. Quick and dirty.
 */
function MYMODULE_node_access(NodeInterface $node, $op, AccountInterface $account) {

  $roles = $account->getRoles();

  $current_language = Drupal::languageManager()->getCurrentLanguage();
  $lang             = $current_language->getId();

  if (!in_array('administrator', $roles) && !in_array('publisher', $roles)) {
    if ($op == 'update' || $op == 'delete') {
      if ($lang == 'en' || $lang == 'fr') {
        return AccessResult::forbidden();
      }
    }
  }

  // No opinion.
  return AccessResult::neutral();
}

command line – flatpak calibre: Cannot read from /home/nicholas/in.epub (permissions?)

Looking to convert an epub to mobi with calibre:

nicholas@gondor:~/ebooks$ 
nicholas@gondor:~/ebooks$ flatpak --command="sh" run com.calibre_ebook.calibre -c "ebook-convert ~/in.epub ~/out.mobi"
Cannot read from /home/nicholas/in.epub
nicholas@gondor:~/ebooks$ 
nicholas@gondor:~/ebooks$ ll
total 1200
drwxrwxr-x  2 nicholas nicholas    4096 Jul 18 13:43 ./
drwxr-xr-x 28 nicholas nicholas    4096 Jul 18 13:16 ../
-rw-r--r--  1 nicholas nicholas 1220236 Jul 18 13:16 in.epub
nicholas@gondor:~/ebooks$ 
nicholas@gondor:~/ebooks$ uname -a
Linux gondor 5.8.0-59-generic #66-Ubuntu SMP Thu Jun 17 00:46:01 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
nicholas@gondor:~/ebooks$ 
nicholas@gondor:~/ebooks$ flatpak info com.calibre_ebook.calibre

calibre - The one stop solution to all your e-book needs

          ID: com.calibre_ebook.calibre
         Ref: app/com.calibre_ebook.calibre/x86_64/stable
        Arch: x86_64
      Branch: stable
     Version: 5.23.0
     License: GPL-3.0
      Origin: flathub
  Collection: org.flathub.Stable
Installation: system
   Installed: 360.9 MB
     Runtime: org.freedesktop.Platform/x86_64/20.08
         Sdk: org.freedesktop.Sdk/x86_64/20.08

      Commit: 13464e660f35716a725261af4b45d3abc199a3ce52ebdd9ee887c7ae623b5873
      Parent: 4f7f3b603f31cc781caf8260f887118a1bb466748891c9e122826728e25d3eed
     Subject: Update calibre-5.22.1-x86_64.txz to 5.23.0 (9184a3f3)
        Date: 2021-07-11 19:56:21 +0000
nicholas@gondor:~/ebooks$ 

The file was readable and converted to mobi fine with an online converter. The converted file loaded on a Kindle fine, so there’s presumably no problem with the epub itself. The book is readable on the Kindle, converted fine.

How is this accomplished from the console using the flatpak install of calibre?


note: the GUI for calibre reads from the home directory fine and adds books to its library. This book is, in fact, in the calibre library. The scope of the question is just how to use the conversion script for the flatpak install of calibre.

There’s nothing odd or unique about permissions to directories, it’s a vanilla install. Presumably some flatpak weirdness.