Ugh! Being a cashie is currently defined by having a magic hardcoded role in \Drupal\commerce_pos\CashierUsers::getCashiers().

This should be a permission.

CommentFileSizeAuthor
#5 remove_getcashiers-2951785-1.patch750 bytesgmem

Comments

axel.rutz created an issue. See original summary.

gmem’s picture

From what I've seen I don't think it's possible to assign specific permissions to individual users, so having the cashier group is the best way of handling that. It is possible to assign new a new group the permissions to essentially become a cashier, and it's also possible to assign users to more than one group. Curious if you can elaborate a little bit on this issue.

geek-merlin’s picture

It's good practice to have permissions, not undocumented hardcoded roles. You can still create a role and assign that permission by default. Everything else violates the "law of least surprise" ;-).

travis-bradbury’s picture

Is CashierUsers::getCashiers() actually used? I don't see it being used but that might just be incompetent use of my IDE. It does seem like a valid issue though - there are permissions like "access commerce pos pages". You could make a new role called Supervisor with more permissions than Cashier (like "alter product unit price") and if you're thinking "give me all the cashiers in the system" you'd probably expect them to be included. So users that are cashiers is probably better defined as users who have any role that grants the permissions that define a cashier.

gmem’s picture

StatusFileSize
new750 bytes

I can confirm it doesn't seem to see any use anywhere in code, but it may have been intended for something in the commerce-pos-cashier-login.html.twig template? Maybe as some sort of list of available users? Meanwhile here's a patch that removes the function - I haven't experienced any errors in my testing thus far.

gmem’s picture

Status: Active » Needs review

  • smccabe committed 2097392 on 8.x-2.x authored by gmem
    Issue #2951785 by gmem, axel.rutz, tbradbury: Cashier shoud be a...
smccabe’s picture

Status: Needs review » Fixed

Everything should just be the individual cashier permissions, it looks like that is some vestigial function that is never used, if i recall there was an issue to remove that old roles stuff before, this part probably just got missed.

Status: Fixed » Closed (fixed)

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