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


Java MetadataRole类代码示例

本文整理汇总了Java中com.redhat.lightblue.metadata.MetadataRole的典型用法代码示例。如果您正苦于以下问题:Java MetadataRole类的具体用法?Java MetadataRole怎么用?Java MetadataRole使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


MetadataRole类属于com.redhat.lightblue.metadata包,在下文中一共展示了MetadataRole类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: checkPermission

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
private void checkPermission(SecurityContext sc, MetadataRole roleAllowed) {
    final Map<MetadataRole, List<String>> mappedRoles = metadata.getMappedRoles();
    if (mappedRoles == null || mappedRoles.size() == 0) {
        // No authorization was configured
        return;
    }

    List<String> roles = mappedRoles.get(roleAllowed);

    if (roles.contains(MetadataConstants.ROLE_NOONE)) {
        throw new SecurityException("Unauthorized Request");
    } else if (roles.contains(MetadataConstants.ROLE_ANYONE)) {
        return;
    }

    for (String role : roles) {
        if (sc.isUserInRole(role)) {
            return;
        }
    }

    throw new SecurityException("Unauthorized Request. One of the following roles is required: " + roles);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:24,代码来源:AbstractMetadataResource.java

示例2: getDepGraph

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@GET
@LZF
@Path("/{entity}/{version}/dependencies")
public String getDepGraph(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity, @PathParam(PARAM_VERSION) String version) {
    Error.reset();

    checkPermission(sc, MetadataRole.FIND_DEPENDENCIES);
    return new GetDependenciesCommand(entity, version).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:10,代码来源:AbstractMetadataResource.java

示例3: getDiff

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@GET
@LZF
@Path("/{entity}/{version}/diff/{version2}")
public String getDiff(@Context SecurityContext sc,
                      @PathParam(PARAM_ENTITY) String entity,
                      @PathParam(PARAM_VERSION) String version1,
                      @PathParam("version2") String version2) {
    Error.reset();
    checkPermission(sc, MetadataRole.FIND_ENTITY_METADATA);
    return new DiffCommand(entity,version1,version2).run();

}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:13,代码来源:AbstractMetadataResource.java

示例4: getEntityRoles

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@GET
@LZF
@Path("/{entity}/{version}/roles")
public String getEntityRoles(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity, @PathParam(PARAM_VERSION) String version) {
    Error.reset();

    checkPermission(sc, MetadataRole.FIND_ROLES);
    return new GetEntityRolesCommand(entity, version).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:10,代码来源:AbstractMetadataResource.java

示例5: getEntityNames

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@GET
@LZF
@Path("/")
public String getEntityNames(@Context SecurityContext sc) {
    Error.reset();

    checkPermission(sc, MetadataRole.FIND_ENTITY_NAMES);
    return new GetEntityNamesCommand(new String[0]).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:10,代码来源:AbstractMetadataResource.java

示例6: getEntityVersions

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@GET
@LZF
@Path("/{entity}")
public String getEntityVersions(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity) {
    Error.reset();

    checkPermission(sc, MetadataRole.FIND_ENTITY_VERSIONS);
    return new GetEntityVersionsCommand(entity).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:10,代码来源:AbstractMetadataResource.java

示例7: getMetadata

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@GET
@LZF
@Path("/{entity}/{version}")
public String getMetadata(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity, @PathParam(PARAM_VERSION) String version) {
    Error.reset();

    checkPermission(sc, MetadataRole.FIND_ENTITY_METADATA);
    return new GetEntityMetadataCommand(entity, version).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:10,代码来源:AbstractMetadataResource.java

示例8: createMetadata

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@PUT
@LZF
@Path("/{entity}/{version}")
@Consumes(MediaType.APPLICATION_JSON)
public String createMetadata(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity, @PathParam(PARAM_VERSION) String version, String data) {
    Error.reset();

    checkPermission(sc, MetadataRole.INSERT);
    return new CreateEntityMetadataCommand(entity, version, data).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:11,代码来源:AbstractMetadataResource.java

示例9: createSchema

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@PUT
@LZF
@Path("/{entity}/schema={version}")
@Consumes(MediaType.APPLICATION_JSON)
public String createSchema(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity, @PathParam(PARAM_VERSION) String version, String schema) {
    Error.reset();

    checkPermission(sc, MetadataRole.INSERT_SCHEMA);
    return new CreateEntitySchemaCommand(entity, version, schema).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:11,代码来源:AbstractMetadataResource.java

示例10: updateEntityInfo

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@PUT
@LZF
@Path("/{entity}")
@Consumes(MediaType.APPLICATION_JSON)
public String updateEntityInfo(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity, String info) {
    Error.reset();

    checkPermission(sc, MetadataRole.UPDATE_ENTITYINFO);
    return new UpdateEntityInfoCommand(entity, info).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:11,代码来源:AbstractMetadataResource.java

示例11: updateSchemaStatus

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@PUT
@LZF
@Path("/{entity}/{version}/{status}")
public String updateSchemaStatus(@Context SecurityContext sc,
                                 @PathParam(PARAM_ENTITY) String entity,
                                 @PathParam(PARAM_VERSION) String version,
                                 @PathParam("status") String status,
                                 @QueryParam("comment") String comment) {
    Error.reset();

    checkPermission(sc, MetadataRole.UPDATE_ENTITY_SCHEMASTATUS);
    return new UpdateEntitySchemaStatusCommand(entity, version, status, comment).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:14,代码来源:AbstractMetadataResource.java

示例12: setDefaultVersion

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@POST
@LZF
@Path("/{entity}/{version}/default")
public String setDefaultVersion(@Context SecurityContext sc,
                                @PathParam(PARAM_ENTITY) String entity,
                                @PathParam(PARAM_VERSION) String version) {
    Error.reset();

    checkPermission(sc, MetadataRole.UPDATE_DEFAULTVERSION);
    return new SetDefaultVersionCommand(entity, version).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:12,代码来源:AbstractMetadataResource.java

示例13: removeEntity

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@DELETE
@LZF
@Path("/{entity}")
public String removeEntity(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity) {
    Error.reset();

    checkPermission(sc, MetadataRole.DELETE_ENTITY);
    return new RemoveEntityCommand(entity).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:10,代码来源:AbstractMetadataResource.java

示例14: clearDefaultVersion

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@DELETE
@LZF
@Path("/{entity}/default")
public String clearDefaultVersion(@Context SecurityContext sc, @PathParam(PARAM_ENTITY) String entity) {
    Error.reset();

    checkPermission(sc, MetadataRole.UPDATE_DEFAULTVERSION);
    return new SetDefaultVersionCommand(entity, null).run();
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:10,代码来源:AbstractMetadataResource.java

示例15: getMappedRoles

import com.redhat.lightblue.metadata.MetadataRole; //导入依赖的package包/类
@Override
public Map<MetadataRole, List<String>> getMappedRoles() {
    return null;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-rest,代码行数:5,代码来源:AbstractRestCommandTest.java


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