当前位置: 首页>>代码示例>>C++>>正文


C++ ISecResource::setAccessFlags方法代码示例

本文整理汇总了C++中ISecResource::setAccessFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ ISecResource::setAccessFlags方法的具体用法?C++ ISecResource::setAccessFlags怎么用?C++ ISecResource::setAccessFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISecResource的用法示例。


在下文中一共展示了ISecResource::setAccessFlags方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: authorizeWorkunitScope

    virtual bool authorizeWorkunitScope(ISecUser & user, ISecResourceList * resources)
    {
        if(resources)
        {
            int cnt = resources->count();
            for(int i = 0; i < cnt; i++)
            {
                ISecResource* r = resources->queryResource(i);
                if(r)
                    r->setAccessFlags(SecAccess_Full);
            }
        }

        return true;
    }
开发者ID:AsherBond,项目名称:HPCC-Platform,代码行数:15,代码来源:defaultsecuritymanager.hpp

示例2: MakeStringException

	IAuthMap * createAuthMap(IPropertyTree * authconfig)
	{
		CAuthMap* authmap = new CAuthMap(this);

		Owned<IPropertyTreeIterator> loc_iter;
		loc_iter.setown(authconfig->getElements(".//Location"));
		if (loc_iter)
		{
			IPropertyTree *location = NULL;
			loc_iter->first();
			while(loc_iter->isValid())
			{
				location = &loc_iter->query();
				if (location)
				{
					StringBuffer pathstr, rstr, required, description;
					location->getProp("@path", pathstr);
					location->getProp("@resource", rstr);
					location->getProp("@required", required);
					location->getProp("@description", description);

					if(pathstr.length() == 0)
						throw MakeStringException(-1, "path empty in Authenticate/Location");
					if(rstr.length() == 0)
						throw MakeStringException(-1, "resource empty in Authenticate/Location");

					ISecResourceList* rlist = authmap->queryResourceList(pathstr.str());
					if(rlist == NULL)
					{
						rlist = createResourceList("htpasswdsecurity");
						authmap->add(pathstr.str(), rlist);
					}
					ISecResource* rs = rlist->addResource(rstr.str());
                    SecAccessFlags requiredaccess = str2perm(required.str());
					rs->setRequiredAccessFlags(requiredaccess);
					rs->setDescription(description.str());
                    rs->setAccessFlags(SecAccess_Full);//grant full access to authenticated users
				}
				loc_iter->next();
			}
		}

		return authmap;
	}
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:44,代码来源:htpasswdSecurity.cpp

示例3: createFeatureMap

    IAuthMap * createFeatureMap(IPropertyTree * authconfig)
    {
        CAuthMap* feature_authmap = new CAuthMap(this);

        Owned<IPropertyTreeIterator> feature_iter;
        feature_iter.setown(authconfig->getElements(".//Feature"));
        ForEach(*feature_iter)
        {
            IPropertyTree *feature = NULL;
            feature = &feature_iter->query();
            if (feature)
            {
                StringBuffer pathstr, rstr, required, description;
                feature->getProp("@path", pathstr);
                feature->getProp("@resource", rstr);
                feature->getProp("@required", required);
                feature->getProp("@description", description);
                ISecResourceList* rlist = feature_authmap->queryResourceList(pathstr.str());
                if(rlist == NULL)
                {
                    rlist = createResourceList(pathstr.str());
                    feature_authmap->add(pathstr.str(), rlist);
                }
                if (!rstr.isEmpty())
                {
                    ISecResource* rs = rlist->addResource(rstr.str());
                    SecAccessFlags requiredaccess = str2perm(required.str());
                    rs->setRequiredAccessFlags(requiredaccess);
                    rs->setDescription(description.str());
                    rs->setAccessFlags(SecAccess_Full);//grant full access to authenticated users
                }
            }
        }

        return feature_authmap;
    }
开发者ID:Michael-Gardner,项目名称:HPCC-Platform,代码行数:36,代码来源:htpasswdSecurity.cpp

示例4: updateSettings

bool CBaseSecurityManager::updateSettings(ISecUser & sec_user,IArrayOf<ISecResource>& rlist) 
{
    CSecureUser* user = (CSecureUser*)&sec_user;
    if(user == NULL)
        return false;

    int usernum = findUser(user->getName(),user->getRealm());
    if(usernum < 0)
    {
        PrintLog("User number of %s can't be found", user->getName());
        return false;
    }
    bool sqchecked = false, sqverified = false, otpchecked = false;
    int otpok = -1;
    ForEachItemIn(x, rlist)
    {
        ISecResource* secRes = (ISecResource*)(&(rlist.item(x)));
        if(secRes == NULL)
            continue;
        //AccessFlags default value is -1. Set it to 0 so that the settings can be cached. AccessFlags is not being used for settings.
        secRes->setAccessFlags(0);
        if(secRes->getParameter("userprop") && *secRes->getParameter("userprop")!='\0')
        {
            //if we have a parameter in the user or company table it will have been added as a parameter to the ISecUser when 
            // the authentication query was run. We should keep this messiness here so that the the end user is insulated....
            dbValidateSetting(*secRes,sec_user);
            continue;
        }

        const char* resource_name = secRes->getParameter("resource");
        if(resource_name && *resource_name && 
            (stricmp(resource_name, "SSN Masking") == 0 || stricmp(resource_name, "Driver License Masking") == 0))
        {
            //If OTP Enabled and OTP2FACTOR cookie not valid, mask
            if(m_enableOTP)
            {
                if(!otpchecked)
                {
                    const char* otpcookie = sec_user.getProperty("OTP2FACTOR");
                    // -1 means OTP is not enabled for the user. 0: failed verfication, 1: passed verification.
                    otpok = validateOTP(&sec_user, otpcookie);
                    otpchecked = true;
                }
                if(otpok == 0)
                {
                    CSecurityResource* cres = dynamic_cast<CSecurityResource*>(secRes);
                    if(resource_name && *resource_name && cres)
                    {
                        if(stricmp(resource_name, "SSN Masking") == 0)
                        {
                            cres->setValue("All");
                            continue;
                        }
                        else if(stricmp(resource_name, "Driver License Masking") == 0)
                        {
                            cres->setValue("1");
                            continue;
                        }
                    }
                }
                else if(otpok == 1)
                {
                    CSecurityResource* cres = dynamic_cast<CSecurityResource*>(secRes);
                    if(resource_name && *resource_name && cres)
                    {
                        if(stricmp(resource_name, "SSN Masking") == 0)
                        {
                            cres->setValue("None");
                            continue;
                        }
                        else if(stricmp(resource_name, "Driver License Masking") == 0)
                        {
                            cres->setValue("0");
                            continue;
                        }
                    }
                }
            }

            if(m_enableIPRoaming && sec_user.getPropertyInt("IPRoaming") == 1)
            {
                if(!sqchecked)
                {
                    const char* sequest = sec_user.getProperty("SEQUEST");
                    if(sequest && *sequest)
                    {
                        sqverified = validateSecurityQuestion(&sec_user, sequest);
                    }
                    sqchecked = true;
                }
                if(!sqverified)
                {
                    CSecurityResource* cres = dynamic_cast<CSecurityResource*>(secRes);
                    if(resource_name && *resource_name && cres)
                    {
                        if(stricmp(resource_name, "SSN Masking") == 0)
                        {
                            cres->setValue("All");
                            continue;
                        }
//.........这里部分代码省略.........
开发者ID:mokerjoke,项目名称:HPCC-Platform,代码行数:101,代码来源:basesecurity.cpp


注:本文中的ISecResource::setAccessFlags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。