Error while assigning item level permission using SP 2010 Workflow

I am using SP 2010 environment and have created on designer workflow for setting the item level permission.Each item has a string field in the list with values as “SPGroupName1;SPgroupName2;SPgroupName3” I want to provide unique permissions to above mentioned groups. While assigning this complete string workflow throws error while running.

Please guide me on this.

Thanks,Kailash

Error after assigning permissions to a group using CSOM

After assigning permissions to a group on a Sharepoint list, the users of the group trying to access said list get the Microsoft.SharePoint.Client.ServerException: “The list « listTitleExample» does not exist at url «urlExample») “

The code below that I used to assign permissions to a group on a list exits with no errors and adds the RoleAssignments to the list and ClientContext.Web:

 var group = clientContext.Web.SiteGroups.GetById(id);     clientContext.Load(group);  clientContext.ExecuteQuery();     BasePermissions permissions = new BasePermissions();  permissions.Set(PermissionKind.ViewListItems);    RoleDefinitionCreationInformation rdcInfo = new   RoleDefinitionCreationInformation();  rdcInfo.Name = "roleDefName";  rdcInfo.Description = "Description";  rdcInfo.BasePermissions = permissions;  RoleDefinition roleDefinition =   clientContext.Site.RootWeb.RoleDefinitions.Add(rdcInfo);   RoleDefinitionBindingCollection RoleDefinitionBindingColl = new   RoleDefinitionBindingCollection(clientContext);  RoleDefinitionBindingColl.Add(roleDefinition);   List targetList = web.Lists.GetByTitle(listTitle);  targetList.BreakRoleInheritance(true, false);  RoleAssignmentCollection collRoleAssign = targetList.RoleAssignments;  RoleAssignment rollAssign = collRoleAssign.Add(group, RoleDefinitionBindingColl);   web.RoleAssignments.Add(group, RoleDefinitionBindingColl);  web.Update();  clientContext.ExecuteQuery(); 

Only the users who were assigned permissions via the code above get the error.

error “The object is used in the context different from the one associated with the object.” while assigning permissions to item in sub site

I am working on assigning permission groups to the list item which is in sub site level.

the same code is working fine for top level site.but getting error at sub site level.

function SetPermissionsToDocSet { param($ context,$ docSetobject,$ groupName,$ role) try {

    $  groupObj=$  context.Site.RootWeb.SiteGroups.GetByName($  groupName)     $  context.Load($  groupObj)     $  context.ExecuteQuery()       $  roleObj=$  context.Web.RoleDefinitions.GetByName($  role)     $  roleDefBinding=New-Object Microsoft.SharePoint.Client.RoleDefinitionBindingCollection($  context)     $  roleDefBinding.Add($  roleObj)      #Assign permissions       $  context.Load($  docSetobject.RoleAssignments.Add($  groupObj,$  roleDefBinding))     $  docSetobject.Update()     $  context.ExecuteQuery()  }  catch {     Write-Host $  _.Exception.Message   } 

}

The above code is working fine if $ context is root site context.getting the above error if $ context is sub site context.unable to add group to subsite level list item. Please provide solution ASAP.

Assigning Unique Local Addresses to the loopback interface

I have Ubuntu 18.04.2, upgraded from 16:04. Previously I had an IPv6 ULA (Unique Local Address) assigned to the loopback interface in /etc/network/interfaces. I tried to make the same assignment in netplan. Declaring “lo” as an Ethernet interface is accepted by the parser, but it has no effect. How can I assign a ULA to the loopback interface at boot time using netplan? Note: network manager is not mentioned as renderer, so I assume that systemd is operating here.

Assigning user role in custom module redirect to no route

In my custom module i have created ACl

<?xml version="1.0"?>  <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Acl/etc/acl.xsd"> <acl>     <resources>         <resource id="Magento_Backend::admin">             <resource id="ABC_CustomReports::top_level" title="TECNO" sortOrder="10" >                 <resource id="ABC_RecommendedOffer::data" title="Recommended Offer" sortOrder="20">                     <resource id="ABC_GuestRecommendedOffers::guestrecommendedoffersgrid" title="Guest" sortOrder="30" />                 </resource>             </resource>         </resource>     </resources> </acl> 

menu.xml

<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Backend:etc/menu.xsd"> <menu>     <add id="ABC_GuestRecommendedOffers::guestrecommendedoffersgrid"          resource="ABC_RecommendedOffer::guestrecommendedoffersgrid"          title="Guest Offers"          action="guestoffers/"          module="ABC_GuestRecommendedOffers"          sortOrder="20"          parent="ABC_RecommendedOffer::data"/> </menu> 

and controller

<?php  namespace ......;  use Magento\Backend\App\Action; use Magento\Backend\App\Action\Context; use Magento\Framework\Registry; use Magento\Framework\View\Result\PageFactory;  class Index extends Action {  protected $  resultPageFactory;  /**  * Grid constructor.  * @param Context $  context  * @param Registry $  coreRegistry  * @param PageFactory $  resultPageFactory  */ public function __construct(     Context $  context,     PageFactory $  resultPageFactory ) {     $  this->resultPageFactory = $  resultPageFactory;     parent::__construct($  context); }   public function execute() {      $  resultPage = $  this->resultPageFactory->create();     $  this->initPage($  resultPage)->getConfig()->getTitle()->prepend(__('Manage Guest Offers'));     return $  resultPage; } protected function initPage($  resultPage) {     $  resultPage->setActiveMenu('ABC_GuestRecommendedOffers::guestrecommendedoffersgrid')         ->addBreadcrumb(__('Tec'), __('Offers'));      return $  resultPage; }   protected function _isAllowed() {     return $  this->_authorization->isAllowed('ABC_GuestRecommendedOffers::guestrecommendedoffersgrid'); } 

}

when i assign a new user to this module its redirect me to

abc.com/admin/admin/noroute/denied/key/a4e87d5a8d025664311af3048c6904e59cd20509406fd933727fd8637c6d946c/

Problem class of assigning N persons to N tasks, zero costs with prefs

I am looking for the general problem class / computational complexity / algorithms for the following problem:

N tasks must be accomplished by N persons. 1 task to be done by exactly 1 person and vice versa. There is a binary preferences matrix whose (i,j) entry is 0 if person i can not do task j, and 1 if it can.

There are no costs involved, no weights and the number of tasks equals the number of people.

I was searching for it but all I could find was the Assignment Problem which has costs/weights associated with each assignment.

As a last resort, perhaps I can transform my preferences matrix to a cost matrix if person can not do job then cost is infinite else cost is zero?

SharePoint 2013 custom workflow (Sequential) visual studio not assigning task

I am creating a simple sequential workflow using VS 2015 in SP2013 on premise. Trying to assign a task to the user in a ‘Domain\username’ format. The problem is that it is creating a task but not assigning it to the specified user.

createTask1_TaskProperties1.AssignedTo = “Domain”+”\”+”username”;

so when an item is added workflow is in progress and when you click on it you can see the task but ‘Assigned to’ column is empty.

I have tested assigning it to many users (Production users, test users). its only working with one live account of my colleague. that account was site collection admin so I added other test accounts and live accounts as site collection admin. it dint work.

I created a SharePoint group and assigned by retreiving from that group but still no luck. I used our own AD framework to retrieve the users and assign a task, but still no luck. I checked the logs and I compared the account for which it is working with the other which is not working and there is not much in the logs too: I will post the logs here Please see the logs below for working user and non working user: Please check and help me out as I am banging my head over this for two days.

enter image description here

Assigning m balls to n buckets – recursive algorithm

I came across the following problem and the answer to that problem: “Give m balls and n bins. Find out how many ways to assign balls to bins. Notice the buckets has no order. Like (1,2,3) and (3,2,1) are considered the same. eg, m = 3, n = 2, return 2. (1, 2) and (3, 0)”

int assignBalls(int m, int n) {         if (m == 0 || n == 1) {             return 1;         }         if (n > m) {             return assignBalls(m, m);         } else {             return assignBalls(m, n - 1) + assignBalls(m - n, n);         }     } 

This solution seem to work. However I don’t understand how assignBalls(m, n - 1) + assignBalls(m - n, n); works. Why is it considering m-n balls into n bins ?

Assigning rank in another sheet based on Average

I have a list of names with an average beside it for every day Monday-Friday. A subgroup of names within this list will be highlighted. I want a macro to assign ranks of the highlighted individuals based on their average and place a value of their rank in a row of another sheet where each individual has a column. There is one row for each day.

Example. 5 people highlighted in a list of July 1st. Macro looks at other sheet (called Workbook) and finds row corresponding to July 1st. Then finds column corresponding to person with lowest average. Puts 1 in their cell. Repeats this with 2, 3, 4, 5. If 8 people highlighted would do this 1 through 8.

hope this makes sense

The image is not assigning to the correct attribute option after sorting – Magento 2.3.1

Summary of Issue:

I am looking to sort the color attribute options programmatically with input type ‘Visual Swatch’. I have made customization in below files to sort the attribute options:

File 1: vendor/magento/module-swatches/view/adminhtml/templates/catalog/product/attribute/Visual.phtml

in the above file, I have added code before last script tag. (after line 109)

<?php     $  values = [];     $  color = [];      foreach($  block->getOptionValues() as $  value) {         $  value = $  value->getData();         $  values[] = is_array($  value) ? array_map(function($  str) {             return htmlspecialchars_decode($  str, ENT_QUOTES);         }, $  value) : $  value;     }     foreach($  values as $  key => $  val) {       $  color[ucwords($  key)]  = ucwords($  val['store0']);     }     array_multisort($  color, SORT_ASC, $  values);     ?> 

also added the code in below file in getJsonConfig() after line 71

vendor/magento/module-swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php

public function getJsonConfig()     {         $  values = [];         foreach ($  this->getOptionValues() as $  value) {             $  values[] = $  value->getData();         }         //custom code         foreach($  values as $  key => $  val) {           $  mid[ucwords($  key)]  = ucwords($  val['store0']);         }         array_multisort($  mid, SORT_ASC, $  values);         //custom code end         $  data = [             'attributesData' => $  values,             'uploadActionUrl' => $  this->getUrl('swatches/iframe/show'),             'isSortable' => (int)(!$  this->getReadOnly() && !$  this->canManageOptionDefaultOnly()),             'isReadOnly' => (int)$  this->getReadOnly()         ];          return json_encode($  data);     } 

after adding the above code, I am able to sort the attribute options. But the visual swatches don’t sort with respective options.

Please check the below images:

A) Below image is before adding the swatch option.

enter image description here

B) Below image is after adding the option. Here option is sorted correctly alphabet-wise but the image is not assigning to that option. See below image

enter image description here

  Steps to replicate:  (Before replicating the above issue, please add   above custom code)   - Go to Store >> Attribute >> Product    - Search for the color attribute    - Add swatch option with image.   - Check that option get sorted   - But image assigned to last option. 

Expected result: The image should assign to newly added option after sorting.

Actual result: The image does not assign against newly added option after sorting.

Is anything wrong happens after sorting the array?