本文整理汇总了Java中org.springframework.security.acls.model.MutableAcl.deleteAce方法的典型用法代码示例。如果您正苦于以下问题:Java MutableAcl.deleteAce方法的具体用法?Java MutableAcl.deleteAce怎么用?Java MutableAcl.deleteAce使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.security.acls.model.MutableAcl
的用法示例。
在下文中一共展示了MutableAcl.deleteAce方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deletePermission
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Override
public void deletePermission(Long securedObjectId, Class clazz, String recipient, boolean principal, Permission perm)
{
logger.debug("Remove the requested permission for the recipient.");
MutableAcl acl = fetchAclForObject(clazz, securedObjectId);
List<AccessControlEntry> entries = acl.getEntries();
int i = 0;
if (entries != null)
{
for (AccessControlEntry entry : entries)
{
if (entry.getSid().equals(recipient) && entry.getPermission().equals(perm))
acl.deleteAce(i);
else
i++;
}
}
aclService.updateAcl(acl);
if (logger.isDebugEnabled()) {
logger.debug("Deleted securedObject " + securedObjectId + " ACL permissions for recipient " + recipient);
}
}
示例2: revocarPermisos
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
private void revocarPermisos(
Sid sid,
Class<?> objectClass,
Serializable objectIdentifier,
Permission[] permissions) throws NotFoundException {
ObjectIdentity oid = new ObjectIdentityImpl(objectClass, objectIdentifier);
try {
MutableAcl acl = (MutableAcl)aclService.readAclById(oid);
List<Integer> indexosPerEsborrar = new ArrayList<Integer>();
int aceIndex = 0;
for (AccessControlEntry ace: acl.getEntries()) {
if (ace.getSid().equals(sid)) {
for (Permission p: permissions) {
if (p.equals(ace.getPermission()))
indexosPerEsborrar.add(aceIndex);
}
}
aceIndex++;
}
for (Integer index: indexosPerEsborrar)
acl.deleteAce(index);
aclService.updateAcl(acl);
} catch (NotFoundException nfex) {
// Si no troba l'ACL no fa res
}
}
示例3: deletePermission
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
/**
* @param object Set the secured object
* @param recipient Set the recipient principal
* @param permission Set the type of permission
* @param clazz Set the class of object
*
*/
@PreAuthorize("hasRole('PERMISSION_ADMINISTRATE')")
@Transactional(readOnly = false)
public void deletePermission(final SecuredObject object,
final String recipient, final Permission permission,
final Class<? extends SecuredObject> clazz) {
ObjectIdentity oid = new ObjectIdentityImpl(clazz.getCanonicalName(),
object.getId());
MutableAcl acl = (MutableAcl) aclService.readAclById(oid);
Sid sid = new PrincipalSid(recipient);
// Remove all permissions associated with this particular recipient
// (string equality used to keep things simple)
List<AccessControlEntry> entries = acl.getEntries();
for (int i = 0; i < entries.size(); i++) {
if (entries.get(i).getSid().equals(sid)
&& entries.get(i).getPermission().equals(permission)) {
acl.deleteAce(i);
}
}
aclService.updateAcl(acl);
if (logger.isDebugEnabled()) {
logger.debug("Deleted securedObject " + object
+ " ACL permissions for recipient " + recipient);
}
}
示例4: deletePermission
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
/**
* @param object
* Set the secured object
* @param recipient
* Set the recipient principal
* @param permission
* Set the type of permission
* @param clazz
* Set the class of object
*/
@PreAuthorize("hasRole('PERMISSION_ADMINISTRATE')")
@Transactional(readOnly = false)
public void deletePermission(final SecuredObject object,
final String recipient, final Permission permission,
final Class<? extends SecuredObject> clazz) {
ObjectIdentity oid = new ObjectIdentityImpl(clazz.getCanonicalName(),
object.getId());
MutableAcl acl = (MutableAcl) aclService.readAclById(oid);
Sid sid = new PrincipalSid(recipient);
// Remove all permissions associated with this particular recipient
// (string equality used to keep things simple)
List<AccessControlEntry> entries = acl.getEntries();
for (int i = 0; i < entries.size(); i++) {
if (entries.get(i).getSid().equals(sid)
&& entries.get(i).getPermission().equals(permission)) {
acl.deleteAce(i);
}
}
aclService.updateAcl(acl);
if (logger.isDebugEnabled()) {
logger.debug("Deleted securedObject " + object
+ " ACL permissions for recipient " + recipient);
}
}
示例5: updateAcl_deleteEntries
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Test
@ShouldMatchDataSet
public void updateAcl_deleteEntries() {
MutableAcl acl = (MutableAcl) fixture.readAclById(new ObjectIdentityImpl("com.cedac.smartresidence.profile.domain.Home", "1"));
acl.deleteAce(5);
fixture.updateAcl(acl);
}
示例6: deleteAndUpdate
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
private MutableAcl deleteAndUpdate(MutableAcl acl, int indexOfAce) {
if (indexOfAce != -1) {
secureOwner(acl, indexOfAce);
try {
acl.deleteAce(indexOfAce);
acl = aclService.updateAcl(acl);
} catch (NotFoundException e) {
throw new RuntimeException("Revoke acl fail." + e.getMessage());
}
}
return acl;
}
示例7: removePermission
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Override
public <T> void removePermission(Class<T> clazz, Serializable identifier, Sid sid, Permission permission) {
ObjectIdentity identity = new ObjectIdentityImpl(clazz.getCanonicalName(), identifier);
MutableAcl acl = (MutableAcl) aclService.readAclById(identity);
AccessControlEntry[] entries = acl.getEntries().toArray(new AccessControlEntry[acl.getEntries().size()]);
for (int i = 0; i < acl.getEntries().size(); i++) {
if (entries[i].getSid().equals(sid) && entries[i].getPermission().equals(permission)) {
acl.deleteAce(i);
}
}
aclService.updateAcl(acl);
}
示例8: hasPermission
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Transactional
@PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN + " or hasPermission(#ae, 'ADMINISTRATION')")
public Acl revoke(AclEntity ae, Long accessEntryId) {
Assert.notNull(ae, "Acl domain object required");
Assert.notNull(accessEntryId, "Ace id required");
ObjectIdentity objectIdentity = new ObjectIdentityImpl(ae.getClass(), ae.getId());
MutableAcl acl = (MutableAcl) aclService.readAclById(objectIdentity);
int indexOfAce = -1;
for (int i = 0; i < acl.getEntries().size(); i++) {
AccessControlEntry ace = acl.getEntries().get(i);
if (((Long) ace.getId()).equals(accessEntryId)) {
indexOfAce = i;
break;
}
}
if (indexOfAce != -1) {
secureOwner(acl, indexOfAce);
try {
acl.deleteAce(indexOfAce);
acl = aclService.updateAcl(acl);
} catch (NotFoundException e) {
}
}
return acl;
}
示例9: deleteAccessToSid
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Override
public void deleteAccessToSid(String sid, MutableAcl acl)
{
if (!StringUtils.isEmpty(sid))
{
List<AccessControlEntry> entries = acl.getEntries();
if (entries != null)
{
int i = 0;
for (AccessControlEntry entry : entries)
{
String aclSid = "";
if (entry.getSid() instanceof GrantedAuthoritySid)
{
GrantedAuthoritySid gaSid = (GrantedAuthoritySid) entry.getSid();
aclSid = gaSid.getGrantedAuthority();
}
else
{
PrincipalSid pSid = (PrincipalSid) entry.getSid();
aclSid = pSid.getPrincipal();
}
if (sid.equals(aclSid))
acl.deleteAce(i);
else
i++;
}
aclService.updateAcl(acl);
}
}
}
示例10: deleteAccessExceptPublicAndDefault
import org.springframework.security.acls.model.MutableAcl; //导入方法依赖的package包/类
@Override
public void deleteAccessExceptPublicAndDefault(MutableAcl acl)
{
if (acl != null)
{
String owner = ((PrincipalSid)acl.getOwner()).getPrincipal();
List<AccessControlEntry> entries = acl.getEntries();
if (entries != null)
{
int i = 0;
for (AccessControlEntry entry : entries)
{
String aclSid = "";
if (entry.getSid() instanceof GrantedAuthoritySid)
{
GrantedAuthoritySid gaSid = (GrantedAuthoritySid) entry.getSid();
aclSid = gaSid.getGrantedAuthority();
}
else
{
PrincipalSid pSid = (PrincipalSid) entry.getSid();
aclSid = pSid.getPrincipal();
}
if (!aclSid.equalsIgnoreCase(CaNanoRoleEnum.ROLE_ANONYMOUS.toString()) &&
!aclSid.equalsIgnoreCase(CaNanoRoleEnum.ROLE_CURATOR.toString()) &&
!aclSid.equalsIgnoreCase(CaNanoRoleEnum.ROLE_RESEARCHER.toString()) &&
!aclSid.equalsIgnoreCase(owner))
acl.deleteAce(i);
else
i++;
}
aclService.updateAcl(acl);
}
}
}