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.
| Comment | File | Size | Author |
|---|---|---|---|
| #26 | uc_attribute.install.rej_.txt | 604 bytes | cparrish817 |
| #18 | 279611.attribute_perms.2.x.patch | 1.17 KB | cha0s |
| #18 | 279611.attribute_perms.1.x.patch | 7 KB | cha0s |
| #17 | uc_cart_links.module.rej_.txt | 1.41 KB | torgospizza |
| #16 | uc_attribute.module.rej_.txt | 8.46 KB | torgospizza |
Comments
Comment #1
rszrama commentedI'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.
Comment #2
jantoine commented+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
Comment #3
Island Usurper commentedI 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.
Comment #4
rszrama commentedComment #5
Island Usurper commentedThe 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.
Comment #6
Island Usurper commentedComment #7
torgospizzaIs 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!
Comment #8
Island Usurper commentedIt's for 6.x. I wanted to find an excuse not to port it to D5, but I couldn't. ;) So here it is.
Comment #9
rszrama commentedThis 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.
Comment #10
Island Usurper commentedRollin', rollin', rollin'....
Comment #11
rszrama commentedApplied cleanly, looks good. I can still access those tabs, so I'm assuming it's working as expected. : )
Comment #12
Island Usurper commentedGreat.
Committed.
Comment #13
cha0s commentedComment #14
torgospizzaCan you guys port this to Ubercart 1.x (which is what I originally created this issue for). Some of us still use Drupal 5 :(
Comment #15
Island Usurper commentedDoes the patch in #8 work?
Comment #16
torgospizzaNo it didn't, all hunks failed trying to patch UC 1.7. Attached is the .rej file.
Comment #17
torgospizzaSorry, 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).
Comment #18
cha0s commentedHere 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!
Comment #19
torgospizzaPatched perfectly. Thanks!
Comment #20
Island Usurper commentedAlright. Committed both patches.
Comment #21
j0rd commentedOh snap. I've been doing some custom hacks to get this to work. Noticed the change in -beta5. Thanks guys.
Comment #22
cha0s commented#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.
Comment #23
fehin commentedFor ubercart market place, I'm wondering if it can be setup so sellers get email notification when their stock level is below the threshold.
Comment #24
torgospizzaThat's a feature request you should post for the Marketplace module: http://drupal.org/project/ubercart_marketplace
Comment #25
fehin commentedThanks. I'll do that.
Comment #26
cparrish817 commentedNot 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?
Comment #27
torgospizzaDoesn't look like you're doing it right. Read the instructions here: http://drupal.org/patch/apply
Comment #29
j0rd commentedWhile 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.
Comment #30
rszrama commentedI 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.
Comment #31
torgospizzaj0rd,
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.
Comment #32
j0rd commentedFeature 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?