It is clear you need to define some form of permission map and decide how to implement it. The problem is; what strategy to use.

Ask ten developers and get ten answers, most of which won't apply to your specific situation. It really boils down to what you are willing and capable of doing with the resources you have. If you find that the components you have don't supply enough information to make a decision in every case, then you are going to have to develop that yourself. If you do have all the information, but don't have a strategy to implement the decisions, START SIMPLE.

It is not a sin to have your entire logic tied to an IF logic tree, especially initially. Don't over-complicate your solution just because you are looking for elegance. If elegance comes to you, and it provides the solution you are looking for, well... excellent!

A strategy that is useful is compartmentalizing. If you have this THING that needs to only show when a set of values align. Go for it. Make it a TRUE/FALSE subroutine, and then move on. Solve each situation similarly. You are bound to find some overlap. When it is natural, combine or re-use. As you go along, some patterns may emerge that speaks to you of a clear and elegant solution to large portions of your already written logic. Good for you.

The sin will be worrying about optimizations and elegance too early. Don't do that. It will drive you insane. Start simply, make sure it completely works for the situation it was designed for and move on. If you write readable code, comment where necessary, and don't sweat the beauty of it all, you may find you have created a completely suitable solution after all.


In reply to Re^5: Hide Data based on account by snopal
in thread Hide Data based on account by grashoper

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.