コード例 #1
0
ファイル: service_users.py プロジェクト: ThomasG77/mapmint
def AddGroup(conf,inputs,outputs):
	if is_connected(conf):
		c = auth.getCon(conf)
		if c.is_admin(conf["senv"]["login"]):
			for i in ['name','description']:
				if not manage_users.check_group_params(i,inputs[i]['value']):
					conf['lenv']['message'] = 'Parametre %s incorrect'%(i)
					return 4
			if c.add_group(inputs['name']['value'],inputs['description']["value"]):
				outputs["Result"]["value"] = json.dumps([inputs['name']['value'],inputs['description']['value']])
				return 3
			else:
				conf["lenv"]["message"] = 'Erreur sql'
				return 4
		else:
			conf["lenv"]["message"]= zoo._("Action not permited")
			return 4
	else:
		conf["lenv"]["message"]=zoo._("User not authenticated")
                return 4
コード例 #2
0
ファイル: service_users.py プロジェクト: ablayelana/mapmint
def AddGroup(conf,inputs,outputs):
    if is_connected(conf):
        c = auth.getCon(conf)
        if c.is_admin(conf["senv"]["login"]):
            for i in ['name','description']:
                if not manage_users.check_group_params(i,inputs[i]['value']):
                    conf['lenv']['message'] = zoo._('%s value is not acceptable'%(i))
                    return zoo.SERVICE_FAILED
            if c.add_group(inputs['name']['value'],inputs['description']["value"]):
                #outputs["Result"]["value"] = json.dumps([inputs['name']['value'],inputs['description']['value']])
                outputs["Result"]["value"] = zoo._("User successfully inserted")
                return zoo.SERVICE_SUCCEEDED
            else:
                conf["lenv"]["message"] = 'Erreur sql'
                return zoo.SERVICE_FAILED
        else:
            conf["lenv"]["message"]= zoo._("Action not permited")
            return zoo.SERVICE_FAILED
    else:
        conf["lenv"]["message"]=zoo._("User not authenticated")
        return zoo.SERVICE_FAILED
コード例 #3
0
def AddGroup(conf,inputs,outputs):
    if is_connected(conf):
        c = auth.getCon(conf)
        if c.is_admin(conf["senv"]["login"]):
            for i in ['name','description']:
                if not manage_users.check_group_params(i,inputs[i]['value']):
                    conf['lenv']['message'] = zoo._('%s value is not acceptable'%(i))
                    return zoo.SERVICE_FAILED
            if c.add_group(inputs['name']['value'],inputs['description']["value"]):
                #outputs["Result"]["value"] = json.dumps([inputs['name']['value'],inputs['description']['value']])
                outputs["Result"]["value"] = zoo._("User successfully inserted")
                return zoo.SERVICE_SUCCEEDED
            else:
                conf["lenv"]["message"] = 'Erreur sql'
                return zoo.SERVICE_FAILED
        else:
            conf["lenv"]["message"]= zoo._("Action not permited")
            return zoo.SERVICE_FAILED
    else:
        conf["lenv"]["message"]=zoo._("User not authenticated")
        return zoo.SERVICE_FAILED