本文整理了Java中java.security.Permissions.elements()
方法的一些代码示例,展示了Permissions.elements()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Permissions.elements()
方法的具体详情如下:
包路径:java.security.Permissions
类名称:Permissions
方法名:elements
[英]Returns an enumeration of all the Permission objects in all the PermissionCollections in this Permissions object.
[中]返回此权限对象中所有PermissionCollections中所有权限对象的枚举。
代码示例来源:origin: ben-manes/caffeine
@Override
public String toString() {
List<Permission> ps = new ArrayList<Permission>();
for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();) {
ps.add(e.nextElement());
}
return "AdjustablePolicy with permissions " + ps;
}
}
代码示例来源:origin: jankotek/mapdb
public String toString() {
List<Permission> ps = new ArrayList<>();
for (Enumeration<Permission> e = perms.elements(); e.hasMoreElements();)
ps.add(e.nextElement());
return "AdjustablePolicy with permissions " + ps;
}
}
代码示例来源:origin: wildfly/wildfly
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification attachment = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
if (attachment == null) {
return;
}
final List<PermissionFactory> permissions = attachment.getPermissionFactories();
final Enumeration<Permission> e = DEFAULT_PERMISSIONS.elements();
while (e.hasMoreElements()) {
permissions.add(new ImmediatePermissionFactory(e.nextElement()));
}
//make sure they can read the contents of the deployment
ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
try {
File file = root.getRoot().getPhysicalFile();
if(file != null && file.isDirectory()) {
FilePermission permission = new FilePermission(file.getAbsolutePath() + File.separatorChar + "-", "read");
permissions.add(new ImmediatePermissionFactory(permission));
}
} catch (IOException ex) {
throw new DeploymentUnitProcessingException(ex);
}
}
代码示例来源:origin: org.rhq/rhq-script-bindings
public Enumeration<Permission> elements() {
return perms.elements();
}
代码示例来源:origin: org.ow2.orchestra/orchestra-utils
/**
* @param permissions
* @return
*/
public static int getPermissionsSize(final Permissions permissions) {
int size = 0;
final Enumeration<Permission> p = permissions.elements();
while (p.hasMoreElements()) {
size++;
}
return size;
}
代码示例来源:origin: org.ow2.novabpm/novaBpmUtil
/**
* @param permissions
* @return
*/
public static int getPermissionsSize(final Permissions permissions) {
int size = 0;
final Enumeration<Permission> p = permissions.elements();
while (p.hasMoreElements()) {
size++;
}
return size;
}
代码示例来源:origin: org.ow2.bonita/bonita-server
/**
* @param permissions
* @return the permissions size
*/
public static int getPermissionsSize(final Permissions permissions) {
int size = 0;
final Enumeration<Permission> p = permissions.elements();
while (p.hasMoreElements()) {
size++;
}
return size;
}
代码示例来源:origin: org.ow2.bonita/bonita-client
/**
* @param permissions
* @return the permissions size
*/
public static int getPermissionsSize(final Permissions permissions) {
int size = 0;
final Enumeration<Permission> p = permissions.elements();
while (p.hasMoreElements()) {
size++;
}
return size;
}
代码示例来源:origin: org.ow2.bonita/bonita-util-common
/**
* @param permissions
* @return
*/
public static int getPermissionsSize(final Permissions permissions) {
int size = 0;
final Enumeration<Permission> p = permissions.elements();
while (p.hasMoreElements()) {
size++;
}
return size;
}
代码示例来源:origin: freeplane/freeplane
private void checkRequiredPermissions(){
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
final Enumeration<Permission> permissionElements = permissions.elements();
while(permissionElements.hasMoreElements())
sm.checkPermission(permissionElements.nextElement());
}
}
代码示例来源:origin: xap/xap
/**
* Check that the current access control context has all of the given permissions.
*/
private static void checkPermissions(Permissions perms) {
SecurityManager sm = System.getSecurityManager();
if (sm != null) { // should never be null?
Enumeration en = perms.elements();
while (en.hasMoreElements()) {
sm.checkPermission((Permission) en.nextElement());
}
}
}
代码示例来源:origin: org.knopflerfish/framework
/**
*
*/
@Override
public Enumeration<Permission> elements() {
if (unresolved != 0) {
resolve();
}
return pc.elements();
}
代码示例来源:origin: org.jboss.modules/jboss-modules
public Enumeration<Permission> elements() {
return getAssembled().elements();
}
代码示例来源:origin: org.jboss.forge/jboss-modules
public Enumeration<Permission> elements() {
return getAssembled().elements();
}
代码示例来源:origin: org.picketbox/picketbox
Permissions getPermissions()
{
Permissions perms = new Permissions();
Enumeration<Permission> eter = uncheckedPermissions.elements();
while( eter.hasMoreElements() )
{
Permission p = (Permission) eter.nextElement();
perms.add(p);
}
Iterator<Permissions> iter = rolePermissions.values().iterator();
while( iter.hasNext() )
{
Permissions rp = iter.next();
eter = rp.elements();
while( eter.hasMoreElements() )
{
Permission p = eter.nextElement();
perms.add(p);
}
}
return perms;
}
代码示例来源:origin: org.jboss.security/jbosssx-bare
Permissions getPermissions()
{
Permissions perms = new Permissions();
Enumeration<Permission> eter = uncheckedPermissions.elements();
while( eter.hasMoreElements() )
{
Permission p = (Permission) eter.nextElement();
perms.add(p);
}
Iterator<Permissions> iter = rolePermissions.values().iterator();
while( iter.hasNext() )
{
Permissions rp = (Permissions) iter.next();
eter = rp.elements();
while( eter.hasMoreElements() )
{
Permission p = (Permission) eter.nextElement();
perms.add(p);
}
}
return perms;
}
代码示例来源:origin: org.apache.geronimo.modules/geronimo-security
public void commit() throws PolicyContextException {
if (state != OPEN) throw new UnsupportedOperationException("Not in an open state");
for (Iterator principalEntries = principalRoleMapping.entrySet().iterator(); principalEntries.hasNext(); ) {
Map.Entry principalEntry = (Map.Entry) principalEntries.next();
Principal principal = (Principal) principalEntry.getKey();
Permissions principalPermissions = (Permissions) principalPermissionsMap.get(principal);
if (principalPermissions == null) {
principalPermissions = new Permissions();
principalPermissionsMap.put(principal, principalPermissions);
}
HashSet roleSet = (HashSet) principalEntry.getValue();
for (Iterator roles = roleSet.iterator(); roles.hasNext(); ) {
Permissions permissions = (Permissions) rolePermissionsMap.get(roles.next());
if (permissions == null) continue;
for (Enumeration rolePermissions = permissions.elements(); rolePermissions.hasMoreElements(); ) {
principalPermissions.add((Permission) rolePermissions.nextElement());
}
}
}
state = IN_SERVICE;
}
代码示例来源:origin: wildfly/wildfly-core
private static Permissions createPermissions(List<Permission> permissionsList, List<InjectedValue<Permissions>> permissionSetInjectors) throws StartException {
Permissions allPermissions = createPermissions(permissionsList);
for (InjectedValue<Permissions> permissionSetInjector : permissionSetInjectors) {
Permissions permissionSet = permissionSetInjector.getValue();
Enumeration<java.security.Permission> permissions = permissionSet.elements();
while (permissions.hasMoreElements()) {
allPermissions.add(permissions.nextElement());
}
}
return allPermissions;
}
代码示例来源:origin: org.apache.geronimo.ext.openejb/openejb-core
/**
* Removes permissions from <code>toBeChecked</code> that are implied by
* <code>permission</code>.
*
* @param toBeChecked the permissions that are to be checked and possibly culled
* @param permission the permission that is to be used for culling
* @return the culled set of permissions that are not implied by <code>permission</code>
*/
private Permissions cullPermissions(Permissions toBeChecked, Permission permission) {
Permissions result = new Permissions();
for (Enumeration e = toBeChecked.elements(); e.hasMoreElements();) {
Permission test = (Permission) e.nextElement();
if (!permission.implies(test)) {
result.add(test);
}
}
return result;
}
}
代码示例来源:origin: org.jboss.eap/wildfly-ee
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
DeploymentUnit deploymentUnit = phaseContext.getDeploymentUnit();
final ModuleSpecification attachment = deploymentUnit.getAttachment(Attachments.MODULE_SPECIFICATION);
if (attachment == null) {
return;
}
final List<PermissionFactory> permissions = attachment.getPermissionFactories();
final Enumeration<Permission> e = DEFAULT_PERMISSIONS.elements();
while (e.hasMoreElements()) {
permissions.add(new ImmediatePermissionFactory(e.nextElement()));
}
//make sure they can read the contents of the deployment
ResourceRoot root = deploymentUnit.getAttachment(Attachments.DEPLOYMENT_ROOT);
try {
File file = root.getRoot().getPhysicalFile();
if(file != null && file.isDirectory()) {
FilePermission permission = new FilePermission(file.getAbsolutePath() + File.separatorChar + "-", "read");
permissions.add(new ImmediatePermissionFactory(permission));
}
} catch (IOException ex) {
throw new DeploymentUnitProcessingException(ex);
}
}
内容来源于网络,如有侵权,请联系作者删除!