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


Java RBACModel类代码示例

本文整理汇总了Java中de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel的典型用法代码示例。如果您正苦于以下问题:Java RBACModel类的具体用法?Java RBACModel怎么用?Java RBACModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RBACModel类属于de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac包,在下文中一共展示了RBACModel类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createRandomContext

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
/**
 * Creates a new context using an RBAC access control model.<br>
 * Users and permissions to execute transactions are randomly assigned
 * to the given roles.<br>
 * Each person is assigned to exactly one role.
 *
 * @param activities The process activities.
 * @param originatorCount The number of desired originators.
 * @param roles The roles to use.
 * @return A new randomly generated Context.
 */
public static ProcessContext createRandomContext(Set<String> activities, int originatorCount, List<String> roles) {
        Validate.notNull(activities);
        Validate.noNullElements(activities);
        Validate.notNegative(originatorCount);
        Validate.notNull(roles);
        Validate.noNullElements(roles);

        ProcessContext newContext = new ProcessContext("Random Context");
        newContext.setActivities(activities);
        List<String> cOriginators = createSubjectList(originatorCount);
        newContext.setSubjects(new HashSet<>(cOriginators));
        //Create a new access control model.
        newContext.setACModel(RBACModel.createRandomModel(cOriginators, activities, roles));
        return newContext;
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:27,代码来源:ProcessContext.java

示例2: getButtonEditRoleMembership

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
private JButton getButtonEditRoleMembership() {
    if (btnEditRoleMembership == null) {
        btnEditRoleMembership = new JButton("Edit role membership");
        btnEditRoleMembership.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    RoleMembershipDialog.showDialog(ACModelDialog.this, (RBACModel) getDialogObject());
                    updateTextArea();
                } catch (Exception e1) {
                    internalException("Cannot launch role membership dialog.", e1);
                }
            }
        });
    }
    return btnEditRoleMembership;
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:17,代码来源:ACModelDialog.java

示例3: getButtonEditPermissions

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
private JButton getButtonEditPermissions() {
        if (btnEditPermissions == null) {
            btnEditPermissions = new JButton("Edit Permissions");
            btnEditPermissions.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if (getDialogObject() == null) {
                        return;
                    }
                    try {
                        if (getDialogObject() instanceof ACLModel) {
                            PermissionDialog.showDialog(ACModelDialog.this, "Edit subject permissions", (ACLModel) getDialogObject());
                            updateTextArea();
                        } else {
//							System.out.println(((RBACModel) getDialogObject()).getRolePermissions().getContext());
                            PermissionDialog.showDialog(ACModelDialog.this, "Edit role permissions", ((RBACModel) getDialogObject()).getRolePermissions());
                        }
                    } catch (Exception ex) {
                        internalException("Cannot launch permission dialog.", ex);
                        return;
                    }
                    updateTextArea();
                }
            });
        }
        return btnEditPermissions;
    }
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:27,代码来源:ACModelDialog.java

示例4: getCheckBoxPropagateRights

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
private JCheckBox getCheckBoxPropagateRights() {
    if (chckbxPropagateRights == null) {
        chckbxPropagateRights = new JCheckBox("Propagate rights along lattice");
        chckbxPropagateRights.addItemListener(new ItemListener() {

            @Override
            public void itemStateChanged(ItemEvent e) {
                if ((getDialogObject() != null) && (getDialogObject().getType() == ACModelType.RBAC)) {
                    ((RBACModel) getDialogObject()).setRightsPropagation(chckbxPropagateRights.isSelected());
                    updateTextArea();
                }
            }

        });
    }
    return chckbxPropagateRights;
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:18,代码来源:ACModelDialog.java

示例5: getButtonEditRoleLattice

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
private JButton getButtonEditRoleLattice() {
    if (btnEditRoleLattice == null) {
        btnEditRoleLattice = new JButton("Edit role lattice");
        btnEditRoleLattice.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                try {
                    RoleLatticeDialog.showDialog(ACModelDialog.this, ((RBACModel) getDialogObject()).getRoleLattice());
                } catch (Exception e1) {
                    internalException("Cannot launch role lattice dialog.", e1);
                    return;
                }
                updateTextArea();
            }
        });
    }
    return btnEditRoleLattice;
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:18,代码来源:ACModelDialog.java

示例6: updateSubjectDescriptorMenu

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
private void updateSubjectDescriptorMenu() throws Exception {
	// submenu3.removeAll();
	if (SwatComponents.getInstance().containsACModels()) {
		if (graph instanceof SwatIFNetGraph) {
			if(graph.getCurrentAnalysisContext() != null){
			AbstractACModel acModel = graph.getCurrentAnalysisContext().getACModel();
			PNGraphCell selectedCell = (PNGraphCell) graph.getSelectionCell();
			AbstractIFNetTransition<IFNetFlowRelation> t = graph.getNetContainer().getPetriNet().getTransition(selectedCell.getId());
			List<String> authorizedSubjects = null;
			if (acModel instanceof ACLModel)
				authorizedSubjects = acModel.getAuthorizedSubjectsForTransaction(selectedCell.getId());
			if (acModel instanceof RBACModel)
				authorizedSubjects = ((RBACModel) acModel).getRolePermissions().getAuthorizedSubjectsForTransaction(selectedCell.getId());
			for (final String s : authorizedSubjects) {
				JMenuItem item = new JMenuItem(s);
				item.addActionListener(new ActionListener() {

					@Override
					public void actionPerformed(ActionEvent e) {
						((mxGraphModel) graph.getModel()).execute(new SubjectDescriptorChange(graph, ((PNGraphCell) graph.getSelectionCell()).getId(), s));

					}
				});
				submenuSubjectDescriptor.add(item);
			}

		} else {
			JMenuItem noSubjects = new JMenuItem("No Subjects Defined");
			submenuSubjectDescriptor.add(noSubjects);
			noSubjects.setEnabled(false);
		}
		}
	}
}
 
开发者ID:iig-uni-freiburg,项目名称:SWAT20,代码行数:35,代码来源:SwatTransitionPopupMenu.java

示例7: RoleMembershipDialog

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
public RoleMembershipDialog(Window owner, RBACModel rbacModel) throws Exception {
	super(owner, ButtonPanelLayout.CENTERED);
	Validate.notNull(rbacModel);
	if(rbacModel.getRoles().isEmpty()){
		throw new ParameterException(ErrorCode.EMPTY, "RBAC model does not contain any roles");
	}
	setDialogObject(rbacModel);
	setOKButtonText("Done");
	setIncludeCancelButton(false);
	setPreferredSize(new Dimension(400,300));
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:12,代码来源:RoleMembershipDialog.java

示例8: main

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	SOABase context = new SOABase("c1");
	context.setSubjects(Arrays.asList("U1","U2","U3","U4","U5","U6","U7","U8","U9","U10","U11","U12","U13","U14"));
	context.setActivities(Arrays.asList("T1","T2","T3","T4","T5"));
	
	RoleLattice l = new RoleLattice(Arrays.asList("role0", "role1", "role2", "role3"));
	l.addRelation("role0", "role1");
	l.addRelation("role0", "role2");
	l.addRelation("role1", "role3");
	l.addRelation("role2", "role3");
	RBACModel rbac = new RBACModel("rbac1", context, l);
	
	
	rbac.setRoleMembership("role0", Arrays.asList("U8"));
	rbac.setRoleMembership("role1", Arrays.asList("U1","U3"));
	rbac.setRoleMembership("role2", Arrays.asList("U5","U7"));
	rbac.setRoleMembership("role3", Arrays.asList("U3","U4"));
	System.out.println("roles for user U1: " + rbac.getRolesFor("U1", true) + "(with rights propagation)");
	
	rbac.setActivityPermission("role0", new HashSet<String>(Arrays.asList("T4")));
	rbac.setActivityPermission("role1", new HashSet<String>(Arrays.asList("T2")));
	rbac.setActivityPermission("role2", new HashSet<String>(Arrays.asList("T3")));
	rbac.setActivityPermission("role3", new HashSet<String>(Arrays.asList("T1","T5")));
	
	RoleMembershipDialog.showDialog(null, rbac);
	System.out.println(rbac);
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:28,代码来源:RoleMembershipDialog.java

示例9: PermissionDialog

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
public PermissionDialog(Window owner, String title, AbstractACModel acModel) throws Exception {
	super(owner, ButtonPanelLayout.CENTERED);
	setTitle(title);
	setIncludeCancelButton(false);
	if(!acModel.getContext().containsActivities())
		throw new ParameterException(ErrorCode.EMPTY, "Access control model does not contain any " + acModel.getContext().getActivityDescriptorPlural().toLowerCase());
	if(!acModel.getContext().containsSubjects())
		throw new ParameterException(ErrorCode.EMPTY, "Access control model does not contain any " + acModel.getContext().getSubjectDescriptorPlural().toLowerCase());
	if(acModel instanceof ACLModel){
		this.aclModel = (ACLModel) acModel;
	} else if(acModel instanceof RBACModel){
		this.aclModel = ((RBACModel) acModel).getRolePermissions();
	}
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:16,代码来源:PermissionDialog.java

示例10: addComponents

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
@Override
protected void addComponents() throws Exception {
    mainPanel().setLayout(new BorderLayout());

    JPanel topComponentsPanel = new JPanel();
    BoxLayout layout = new BoxLayout(topComponentsPanel, BoxLayout.PAGE_AXIS);
    topComponentsPanel.setLayout(layout);
    topComponentsPanel.add(Box.createVerticalStrut(10));
    JPanel namePanel = new JPanel();
    BoxLayout namePanelLayout = new BoxLayout(namePanel, BoxLayout.LINE_AXIS);
    namePanel.setLayout(namePanelLayout);
    JLabel nameLabel = new JLabel("Name:", JLabel.RIGHT);
    nameLabel.setPreferredSize(LABEL_DIMENSION);
    nameLabel.setMinimumSize(LABEL_DIMENSION);
    nameLabel.setMaximumSize(LABEL_DIMENSION);
    namePanel.add(nameLabel);
    namePanel.add(getFieldName());
    topComponentsPanel.add(namePanel);
    topComponentsPanel.add(Box.createVerticalStrut(10));
    topComponentsPanel.add(getPanelContext());
    topComponentsPanel.add(Box.createVerticalStrut(10));
    topComponentsPanel.add(new JSeparator(JSeparator.HORIZONTAL));
    topComponentsPanel.add(getPanelPermissions());
    if (getDialogObject() instanceof RBACModel) {
        topComponentsPanel.add(new JSeparator(JSeparator.HORIZONTAL));
        topComponentsPanel.add(getPanelRoles());
    }
    topComponentsPanel.add(new JSeparator(JSeparator.HORIZONTAL));
    mainPanel().add(topComponentsPanel, BorderLayout.PAGE_START);

    mainPanel().add(getPanelTextArea(), BorderLayout.CENTER);
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:33,代码来源:ACModelDialog.java

示例11: getPanelPermissions

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
protected JPanel getPanelPermissions() {
    if (panelPermissions == null) {
        panelPermissions = new JPanel();
        BoxLayout l = new BoxLayout(panelPermissions, BoxLayout.LINE_AXIS);
        panelPermissions.setLayout(l);
        panelPermissions.add(Box.createHorizontalGlue());
        panelPermissions.add(getButtonEditPermissions());
        if (getDialogObject() instanceof RBACModel) {
            panelPermissions.add(getCheckBoxPropagateRights());
        }
        panelPermissions.add(Box.createHorizontalGlue());
    }
    return panelPermissions;
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:15,代码来源:ACModelDialog.java

示例12: getProcessContext

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
private static ProcessContext getProcessContext(){
	ProcessContext bla = new ProcessContext("Test Process-Context");
	bla.setACModel(new RBACModel("RBAC"));
	return bla;
}
 
开发者ID:iig-uni-freiburg,项目名称:SEPIA,代码行数:6,代码来源:AllTimedNetTests.java

示例13: getDialogObject

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
@Override
public RBACModel getDialogObject() {
	return (RBACModel) super.getDialogObject();
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:5,代码来源:RoleMembershipDialog.java

示例14: showDialog

import de.uni.freiburg.iig.telematik.sewol.accesscontrol.rbac.RBACModel; //导入依赖的package包/类
public static void showDialog(Window owner, RBACModel rbacModel) throws Exception{
	RoleMembershipDialog dialog = new RoleMembershipDialog(owner, rbacModel);
	dialog.setUpGUI();
	dialog.getDialogObject();
}
 
开发者ID:iig-uni-freiburg,项目名称:SEWOL,代码行数:6,代码来源:RoleMembershipDialog.java


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