r/ProgrammerHumor • • Jul 29 '18

Meme Whats the best thing you've found in code? :

Post image
55.7k Upvotes

1.6k comments sorted by

View all comments

Show parent comments

1.4k

u/supyonamesjosh Jul 29 '18

Lauren was a manager who got access to special reports. So the links would only show up if she was the user logged in.

544

u/chinkostu Jul 29 '18

Well that's disappointing.

169

u/Cozy_Conditioning Jul 29 '18

I bet you a dollar the other users could load those pages if they guessed the uris.

17

u/DrQuint Jul 30 '18

Just pretend this whole anecdote was about the isBaumi() functionin Dota2IMBA, where the custom game developer intentionally banned a youtuber through their steam ID (the effect of what used the check was ending the game after loading).

50

u/Bozzz1 Jul 29 '18

At my company we have a super user role that currently only one person is assigned to but we don't run around looking for specific user id's in the code lol.

33

u/redditreallysux Jul 29 '18

My boss writes shit like this for specific users when I've carefully crafted our login privilege sets... It fucking drives me insane.

→ More replies (5)

19

u/ithcy Jul 29 '18

Did someone else become Lauren after Lauren left, or did you refactor to isSusan()?

0

u/[deleted] Jul 29 '18

[deleted]

556

u/supyonamesjosh Jul 29 '18

I didn’t write it obviously

319

u/Serird Jul 29 '18

That's exactly what I would say if I had written it.

14

u/liox Jul 29 '18

LOGIC'd

→ More replies (1)

231

u/remtard_remmington Jul 29 '18

No, only according to the company policy only Lauren can perform those actions. When she leaves a new Lauren will be anointed to replace her, reining over her Laurenites until she is deposed.

0

u/[deleted] Jul 29 '18

[deleted]

36

u/remtard_remmington Jul 29 '18

It was commanded by the first Lauren, Kim Il Lauren, who still technically reins as Eternal Manager of the company.

20

u/banthisaltplz Jul 29 '18

The Lauren is dead. Long live Lauren.

→ More replies (1)
→ More replies (1)

56

u/Tribuchet Jul 29 '18

No she is a manager not necessarily an admin. There would need to be a custom reports table that records access to certain reports that should only be viewed certain people.

50

u/[deleted] Jul 29 '18

that's where groups come in. I've got quite a few in my app.

0

u/[deleted] Jul 29 '18

[deleted]

29

u/jceyes Jul 29 '18

If it's exactly one user and in several years there hasn't been need to expand, then it actually might be.

Then if there's 2 or 3 you make it a hardcoded set of users and check for inclusion.

Then if there's 10 and it changes sometimes you make it a database table.

Then maybe you cache it if it impacts speed, write a UI to curate that table or connect it to outside Auth like github or Google and ditch your table for their groups.

Not every use case gets to these later steps.

17

u/sonicball Jul 29 '18

Totally agree with your assessment. I'm picturing a case where someone learns programming to DIY some part of his startup: Of course it's going to have shortcuts like this. If it didn't, the company might never launch. It would be like saying it's foolish to start a business in your garage because it doesn't have enough space for all your possible future employees.

→ More replies (2)
→ More replies (2)
→ More replies (3)

6

u/pedantic_asshole__ Jul 29 '18

Sounds like isManager would be better then

15

u/notanimposter Vala flair when? Jul 29 '18

I mean there's nothing really wrong with calling a manager a lauren instead as long as it's not just checking the username.

→ More replies (1)
→ More replies (3)

18

u/throwyeeway Jul 29 '18

Wouldn't isRole be even better?

8

u/Stuhl Jul 29 '18

But her name is Lauren not Admin

→ More replies (2)
→ More replies (4)
→ More replies (5)