casbin/management_api.cpp
bool Enforcer :: AddNamedPolicy(const std::string& p_type, const std::vector<std::string>& params) {
    if (params.size() == 1) {
        std::vector<std::string> str_slice{params[0]};
        return this->addPolicy("p", p_type, str_slice);
    }

    std::vector<std::string> policy;
    for (int i = 0 ; i < params.size() ; i++)
        policy.push_back(params[i]);
    return this->addPolicy("p", p_type, policy);
}
// AddNamedPolicy adds an authorization rule to the current named policy.
// If the rule already exists, the function returns false and the rule will not be added.
// Otherwise the function returns true by adding the new rule.
AddNamedPolicy adds an authorization rule to the current named policy.
If the rule already exists, the function returns false and the rule will not be added.
Otherwise the function returns true by adding the new rule.
AddNamedPolicy adds an authorization rule to the current named policy . If the rule already exists the function returns false and the rule will not be added . Otherwise the function returns true by adding the new rule .
bool Enforcer :: AddNamedPolicy(const std::string& p_type, const std::vector<std::string>& params) {
    if (params.size() == 1) {
        std::vector<std::string> str_slice{params[0]};
        return this->addPolicy("p", p_type, str_slice);
    }
    std::vector<std::string> policy;
    for (int i = 0 ; i < params.size() ; i++)
        policy.push_back(params[i]);
    return this->addPolicy("p", p_type, policy);
}
bool Enforcer :: AddNamedPolicy ( const std :: string & p_type , const std :: vector < std :: string > & params ) { if ( params . size ( ) == 1 ) { std :: vector < std :: string > str_slice { params [ 0 ] } ; return this -> addPolicy ( " " , p_type , str_slice ) ; } std :: vector < std :: string > policy ; for ( int i = 0 ; i < params . size ( ) ; i ++ ) policy . push_back ( params [ i ] ) ; return this -> addPolicy ( " " , p_type , policy ) ; }
AddNamedPolicy adds an authorization rule to the current named policy.
AddNamedPolicy adds an authorization rule to the current named policy .