Jump to content

usergroup permissions


newb

Recommended Posts

chaps - please take note of the original question. whilst this is all good, and i'm picking stuff up from the argument that i didnt know before, the arguments of hex vs dec, encapsulation vs constants, etc are not gonna help the OP.

you both know your stuff - that's pretty obvious - but can you possibly stick to the topic and present a solution rather than a "best practice" argument?

cheers
Link to comment
Share on other sites

[quote author=Jenk link=topic=110890.msg450740#msg450740 date=1160615509]
Don't have to use hex, can stick with decimal..

[code]<?php

if (!($perm ^ 2))
{
    $perm = $perm | 2;
}

?>[/code]
[/quote]

2 looks like a literal to me.

redbull, it would appear that the original question has been answered and that the topic has been changed to, "How do we design a system that can handle not only permissions for a forums module, but any other module we decide to add in the future?"
Link to comment
Share on other sites

[quote author=roopurt18 link=topic=110890.msg451135#msg451135 date=1160688339]
[quote author=Jenk link=topic=110890.msg450740#msg450740 date=1160615509]
Don't have to use hex, can stick with decimal..

[code]<?php

if (!($perm ^ 2))
{
    $perm = $perm | 2;
}

?>[/code]
[/quote]

2 looks like a literal to me.

redbull, it would appear that the original question has been answered and that the topic has been changed to, "How do we design a system that can handle not only permissions for a forums module, but any other module we decide to add in the future?"
[/quote]Nice of you to ignore my reply after that ;)

I'm done.
Link to comment
Share on other sites

  • 2 years later...
[quote author=Jenk link=topic=110890.msg450747#msg450747 date=1160616785]Constants break encapsulation.[/quote]

Not always...

[code]<?php
   
    class messages {
       
        const TYPE_ERROR = 1;
        const TYPE_CONFIRM = 2;
       
        function add_message($message, $type = TYPE_ERROR) {
           
        }
    }
   
    //normal use
    $message = new messages();
    $message->add_message("Well done!", messages::TYPE_CONFIRM);
    $message->add_message("Warning though, don't do this again", messages::TYPE_ERROR);
   
?>[/code]

Source: http://www.coderprofile.com/networks/discussion-forum/1694/is-there-a-name-for-this

Kind regards,
Scott
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.