本文整理了Java中org.ff4j.core.Feature.getPermissions()
方法的一些代码示例,展示了Feature.getPermissions()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getPermissions()
方法的具体详情如下:
包路径:org.ff4j.core.Feature
类名称:Feature
方法名:getPermissions
[英]Getter accessor for attribute 'permissions'.
[中]属性“permissions”的Getter访问器。
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public void grantRoleOnFeature(String uid, String roleName) {
assertFeatureExist(uid);
assertHasLength(roleName);
featuresMap.get(uid).getPermissions().add(roleName);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
public void removeRoleFromFeature(String uid, String roleName) {
assertFeatureExist(uid);
assertHasLength(roleName);
featuresMap.get(uid).getPermissions().remove(roleName);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String uid, String roleName) {
Util.assertHasLength(roleName);
Feature feat = read(uid);
if (feat.getPermissions() != null && !feat.getPermissions().contains(roleName)) {
Transaction tx = graphDb.beginTx();
Map<String, Object> paramUID = new HashMap<>();
paramUID.put("uid", uid);
paramUID.put("roleName", roleName);
graphDb.execute(QUERY_CYPHER_ADD_ROLE, paramUID);
tx.success();
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
// modify
f.getPermissions().add(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
// modify
f.getPermissions().add(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
public void assertRoleDoesNotExist(String featureUID, String role) {
if (ff4j.getFeatureStore().read(featureUID).getPermissions().contains(role)) {
throw new RoleExistsException();
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
// modify
f.getPermissions().add(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeRoleFromFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
f.getPermissions().remove(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeRoleFromFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
f.getPermissions().remove(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeRoleFromFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
f.getPermissions().remove(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
public void assertRoleExist(String featureUID, String role) {
if (!ff4j.getFeatureStore().read(featureUID).getPermissions().contains(role)) {
throw new RoleNotExistsException();
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeRoleFromFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
f.getPermissions().remove(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String flipId, String roleName) {
Util.assertParamHasLength(roleName, "roleName (#2)");
// retrieve
Feature f = read(flipId);
// modify
f.getPermissions().add(roleName);
// persist modification
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String uid, String roleName) {
Util.assertHasLength(roleName);
assertFeatureExist(uid);
Feature f = read(uid);
f.getPermissions().add(roleName);
update(f);
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeRoleFromFeature(String uid, String roleName) {
Util.assertHasLength(roleName);
assertFeatureExist(uid);
Feature f = read(uid);
f.getPermissions().remove(roleName);
update(f);
}
代码示例来源:origin: ff4j/ff4j
/**
* Query children roles.
*
* @param fp
*/
private void readPermissions(Feature fp) {
fp.getPermissions().addAll(
getJdbcTemplate().query(getQueryBuilder().getRoles(),
new SingleColumnRowMapper<String>(), fp.getUid()));
}
代码示例来源:origin: ff4j/ff4j
/**
* Remove all existing permissions and create new.
*
* @param fp
*/
private void createPermissions(Feature fp) {
if (fp.getPermissions() != null) {
getJdbcTemplate().update(getQueryBuilder().deleteRoles(), fp.getUid());
for (String role : fp.getPermissions()) {
getJdbcTemplate().update(getQueryBuilder().addRoleToFeature(), fp.getUid(), role);
}
}
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void grantRoleOnFeature(String flipId, String roleName) {
assertFeatureExist(flipId);
Util.assertHasLength(roleName);
Feature feature = read(flipId);
feature.getPermissions().add(roleName);
getConnection().execute(getBuilder().queryUpdateFeature(feature));
}
代码示例来源:origin: ff4j/ff4j
/** {@inheritDoc} */
@Override
public void removeRoleFromFeature(String flipId, String roleName) {
assertFeatureExist(flipId);
Util.assertHasLength(roleName);
Feature feature = read(flipId);
feature.getPermissions().remove(roleName);
getConnection().execute(getBuilder().queryUpdateFeature(feature));
}
代码示例来源:origin: ff4j/ff4j
/**
* Exposition of 'getAuthorizations' method
*
* @param featureID
* target feature id
*/
@ManagedOperation(description = "Returns feature authentication roles")
@ManagedOperationParameters({@ManagedOperationParameter(name = "featureId", description = "Identifier of feature to get Roles")})
public Set<String> getPermissions(String featureId) {
return getFf4j().getFeature(featureId).getPermissions();
}
内容来源于网络,如有侵权,请联系作者删除!