Next Previous Contents

4. USERACCT_COMNG object

#Specification: USERACCT_COMNG / principles ([usercomng.cc,1])

The class USERACCT_COMNG (User Account Co-manager) allows any components or module to to enhance another dialog. The dialog has to be USERACCT_COMNG aware, but this represents minor work. So far, this has been applied to the user account dialog (thus the name of the class). The component may define new fields (generally in a new section) and proper functions are called to do the various validations. An object of the class REGISTER_USERACCT_COMNG must be defined with a pointer to a function creating a USERACCT_COMNG or not. If a component do not want to participate in the management of a specific dialog or user type, the function return NULL. Normally the fonction return an instance of a class derived from USERACCT_COMNG.

#Specbeg: USERACCT_COMNG / registration / sample ([privi.cc,512])

        /*
            This function defines a co-manager only for a user account dialog
            (key == "user"). Further, using the DICTIONARY object, it gets
            more information about the dialog. It creates the co-manager
            only for normal user account in the main domain.
        */
        USERACCT_COMNG *privi_newcomng(
            const char *key,
            DICTIONARY &dict)
        {
            USERACCT_COMNG *ret = NULL;
            const char *domain = dict.get_str ("domain");
            int categ = dict.get_int ("categ");
            if (strcmp(key,"user")==0
                && strcmp(domain,"/")==0
                && categ == TUSER_STD){
                ret = new USERPRIVI_COMNG (dict);
            }
            return ret;
        }
        
        static REGISTER_USERACCT_COMNG ppriv (privi_newcomng);

#Specbeg: USERACCT_COMNG / dialog setup ([users.cc,642])

        /*
            The following code define the context for the co-manager
            and enable them.
        */
        USERACCT_COMNGS comngs;
        comngs.set_bool ("is_new",is_new);
        comngs.set_str  ("domain",domain.get());
        comngs.set_str  ("name",usr->getname());
        comngs.set_int ("categ",usr->getcateg());
        // This triggers the REGISTER_USERACCT_COMNG objets
        comngs.getall  ("user");

4.1 Alphabetical function listing

Classe USERACCT_COMNG, vue publique

4.2 registering a co-manager

REGISTER_USERACCT_COMNG::REGISTER_USERACCT_COMNG()

        PUBLIC REGISTER_USERACCT_COMNG::REGISTER_USERACCT_COMNG(
                USERACCT_COMNG *(fct)(const char *key, DICTIONARY&))
        

4.3 Dealing with co-managers

Alphabetical function listing

Classe USERACCT_COMNGS, vue publique


Next Previous Contents