Hi guys,

With the advent of the Ubercart Marketplace module, which I'm going to be using heavily, I've started taking a look at the permissions currently missing from Ubercart. These are mainly just some finer-grained permissions for product node editing, to prevent or allow users from editing Attributes, Options, Adjustments, and Stock.

The new perms added in these patches are "administer product attributes", "administer product stock", "administer product options", and "administer product adjustments".

I hope to get around to Features, Role, etc. But in the meantime, please take a look and consider rolling these into core.

Comments

rszrama’s picture

Status: Needs review » Postponed

I'm not sure we should switch up access to various items in the minor release, unfortunately. I'll definitely consider these changes and others for D6 and beyond, but I wouldn't want to have a whole host of folks update and get thrown off by all the disappearing pages. Even if we mention it, it's likely a majority of folks won't update permissions or expect to have to.

I know that sucks for folks on D5, but my best recommendation would just be to keep your patches handy during updates as long as you're on D5.

I'm postponing this until we get the D6 work into Drupal CVS for issues.

jantoine’s picture

Version: 5.x-1.0-rc5 » 5.x-1.4
Status: Postponed » Reviewed & tested by the community

+1

To get this into core, can't we include an update in install.php that would automatically add the new permissions to any user belonging to a role that had the old permissions?

Cheers,

Jon Antoine
www.antoinesolutions.com
Open source development documentation

Island Usurper’s picture

Version: 5.x-1.4 » 6.x-2.x-dev
Status: Reviewed & tested by the community » Needs work

I agree with Ryan that this should go into the D6 version. That means that these patches need to be rerolled because a lot of changes to the menu hooks were made.

Is there a reason that the 'administer product options' permission isn't used on the option pages in the admin section? I only see it used on the product tab.

rszrama’s picture

Assigned: Unassigned » Island Usurper
Island Usurper’s picture

StatusFileSize
new7.59 KB

The thing about splitting up the attribute permissions is that they are not independent. Being able to change a product's attributes means that you can remove options and adjustments, so someone with only that permission should be able to access those other pages as well. This patch takes care of that, and also has a permission for changing the global attribute data.

Take a look at #373651: Confusion involving attributes and product kits as well. It's only somewhat related since it involves the access callbacks, but it might help knowing about it when applying the patch.

Island Usurper’s picture

Status: Needs work » Needs review
torgospizza’s picture

Is that a 6.x patch? If so, can you roll it into 5.x? Either that or I'll just keep using the patch I wrote way back when I created this Issue. Thanks!

Island Usurper’s picture

StatusFileSize
new5.78 KB

It's for 6.x. I wanted to find an excuse not to port it to D5, but I couldn't. ;) So here it is.

rszrama’s picture

Status: Needs review » Needs work

This patch failed to apply because it looks like Lyle has since made a change to the prior uc_attribute_product_attribute_access() to make sure product kits don't get an attribute tab.

Island Usurper’s picture

Status: Needs work » Needs review
StatusFileSize
new7.66 KB

Rollin', rollin', rollin'....

rszrama’s picture

Status: Needs review » Reviewed & tested by the community

Applied cleanly, looks good. I can still access those tabs, so I'm assuming it's working as expected. : )

Island Usurper’s picture

Great.

Committed.

cha0s’s picture

Status: Reviewed & tested by the community » Fixed
torgospizza’s picture

Can you guys port this to Ubercart 1.x (which is what I originally created this issue for). Some of us still use Drupal 5 :(

Island Usurper’s picture

Version: 6.x-2.x-dev » 5.x-1.7

Does the patch in #8 work?

torgospizza’s picture

StatusFileSize
new8.46 KB

No it didn't, all hunks failed trying to patch UC 1.7. Attached is the .rej file.

torgospizza’s picture

StatusFileSize
new1.41 KB

Sorry, I gave you the wrong .rej file. The attributes module patches fine, but the Cart Links module does not. I did a clean install of Ubercart1.7 and got 1 hunk failing. Attached is the correct rej.

(The other .rej was from my own previous patching of my custom modified .module file).

cha0s’s picture

Status: Fixed » Needs review
StatusFileSize
new7 KB
new1.17 KB

Here ya go. BTW, there was a typo in that last patch that I didn't notice 'til I started testing stuff. Since we released a beta today, I have included an update function in the 2.x branch to address this problem. Clear those caches!

torgospizza’s picture

Patched perfectly. Thanks!

Island Usurper’s picture

Status: Needs review » Fixed

Alright. Committed both patches.

j0rd’s picture

Oh snap. I've been doing some custom hacks to get this to work. Noticed the change in -beta5. Thanks guys.

cha0s’s picture

#395590: Can not administer Attribute is a duplicate.

FWIW, it looks like my 2.x patch to fix the typos didn't make it into the beta. You should get this patch and run update.php or the permission is broken.

fehin’s picture

For ubercart market place, I'm wondering if it can be setup so sellers get email notification when their stock level is below the threshold.

torgospizza’s picture

That's a feature request you should post for the Marketplace module: http://drupal.org/project/ubercart_marketplace

fehin’s picture

Thanks. I'll do that.

cparrish817’s picture

StatusFileSize
new604 bytes

Not sure I'm doing this correctly.
patch -i ~/279611.attribute_perms.2.x.patch -o uc_attribute.install
patching file uc_attribute.install
Hunk #1 FAILED at 617.
1 out of 1 hunk FAILED -- saving rejects to file uc_attribute.install.rej

Did I need to apply the other patch first? am I applying the patches incorrectly?

torgospizza’s picture

Doesn't look like you're doing it right. Read the instructions here: http://drupal.org/patch/apply

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

j0rd’s picture

While this is the first step in expanding on the privileges for uc_stock and uc_attributes, I believe it needs to go a step further (especially if we want to use this for uc_marketplace).

Say you have two sellers in your store. You've set them up in a role with "Create Product" and "Edit Own Product" permissions only. You've also given them "Edit Product Attributes" and "Edit Product Options" .

Now as I understand it with this patch, these sellers will be able to add existing attributes and options to their products ...but if the store administrator hasn't included all the pre-existing attributes/options that a seller might need, he'll have to contact the site administrator to create them for him, so that he can add them to his product.

Otherwise, you'll have to give both sellers, "administer attributes" permission in which case, they can ruin each others options by editing/removing existing options or attributes.

Ideally attributes will be linked to the users account somehow and permissions will have to be able to distinguish between a user who can edit his own products, attributes and options and a user who can edit all products, attributes and options. User who can only Edit his own products, should be able to create/edit his own attribute sets and options sets, and add them to his products. Then only global administrators who can "edit any products", should be also able to edit them.

Globally created attributes and options, should be available to everyone. You should have an option to keep the attribute/option sets privately to only your user.

Let me know if I need to clarify.

rszrama’s picture

I don't think you need to clarify, but this does represent a significant departure from the way the system currently works. I recommend starting a new feature request so discussion doesn't get lost in this closed issue.

torgospizza’s picture

j0rd,

Whoops, Ryan posted while I was posting. This does seem like something that would come in handy, especially for the Reseller system (Marketplace). I see an immediate need for it in some cases (including chum's site which will allow sellers to create their own attributes). I'd be interested in seeing that feature come to fruition.

j0rd’s picture

Feature request posted here: http://drupal.org/node/441516

I think this is something that should work it's way into Ubercart shortly after 2.x is released.

Ubercart 3.x Feature Request Survey anyone?