TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Is there a term/concept/pattern for pushing authorized actions onto an object?

3 pointsby harryloveover 13 years ago
E.g., instead of an object asking, "am I authorized to do this?" over and over again within the context of an application, everything it is allowed to do is pushed to it upon authorization.<p>Does that make sense? Please forgive my naivety and fumbling attempt at an explanation.<p>What do you call this? I'm interested in finding software patterns that implement this.

1 comment

vyrotekover 13 years ago
I depends what it means to be 'authorized' to do something. Do your want to object to only 'know' how to do something it is authorized to do? You might be able to borrow some ideas from the Strategy Pattern to accomplish this. You could assign the object specific strategies for certain tasks based on the permissions you determined and then for the life of the object it would know what it could do and how to do it.
评论 #3011946 未加载