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


Java GroupService.getGroupByNamespaceCodeAndName方法代码示例

本文整理汇总了Java中org.kuali.rice.kim.api.group.GroupService.getGroupByNamespaceCodeAndName方法的典型用法代码示例。如果您正苦于以下问题:Java GroupService.getGroupByNamespaceCodeAndName方法的具体用法?Java GroupService.getGroupByNamespaceCodeAndName怎么用?Java GroupService.getGroupByNamespaceCodeAndName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.kuali.rice.kim.api.group.GroupService的用法示例。


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

示例1: testGroupImportXml

import org.kuali.rice.kim.api.group.GroupService; //导入方法依赖的package包/类
/**
 *
 * Verify that a workgroup with a bad user in the xml is not going to be put in the db.
 *
 * @throws Exception
 */

@Test public void testGroupImportXml() throws Exception {
	loadXmlFile("GroupXmlImportTest.xml");

    IdentityService identityService = KimApiServiceLocator.getIdentityService();
    GroupService groupService = KimApiServiceLocator.getGroupService();
    //verify that the group was ingested
    Group group = groupService.getGroupByNamespaceCodeAndName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE,
            "TestUserGroup");

    assertNotNull(group);
    List<String> members = groupService.getMemberPrincipalIds(group.getId());
    List<String> groups = groupService.getMemberGroupIds(group.getId());
    assertTrue(groupService.isMemberOfGroup(identityService.getPrincipalByPrincipalName("ewestfal").getPrincipalId(), group.getId()));
    assertTrue(groupService.isMemberOfGroup(identityService.getPrincipalByPrincipalName("rkirkend").getPrincipalId(), group.getId()));
    assertTrue(groupService.isMemberOfGroup("2015", group.getId()));
    assertTrue(KimApiServiceLocator.getGroupService().isGroupMemberOfGroup(groupService.getGroupByNamespaceCodeAndName(
            KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE, "TestWorkgroup").getId(), group.getId()));
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:26,代码来源:GroupXmlImportTest.java

示例2: applyVisibility

import org.kuali.rice.kim.api.group.GroupService; //导入方法依赖的package包/类
/**
 * Applies visibility settings to the RemotableAttributeField
 */
private void applyVisibility(RemotableAttributeField.Builder fieldBuilder, RemotableAttributeLookupSettings.Builder attributeLookupSettings, XMLSearchableAttributeContent.FieldDef field) {
    boolean visible = true;
    // if visibility is explicitly set, use it
    if (field.visibility.visible != null) {
        visible = field.visibility.visible;
    } else {
        if (field.visibility.groupName != null) {
            UserSession session = GlobalVariables.getUserSession();
            if (session == null) {
                throw new WorkflowRuntimeException("UserSession is null!  Attempted to render the searchable attribute outside of an established session.");
            }
            GroupService groupService = KimApiServiceLocator.getGroupService();

            Group group = groupService.getGroupByNamespaceCodeAndName(field.visibility.groupNamespace, field.visibility.groupName);
            visible =  group == null ? false : groupService.isMemberOfGroup(session.getPerson().getPrincipalId(), group.getId());
        }
    }
    String type = field.visibility.type;
    if ("field".equals(type) || "fieldAndColumn".equals(type)) {
        // if it's not visible, coerce this field to a hidden type
        if (!visible) {
            fieldBuilder.setControl(RemotableHiddenInput.Builder.create());
        }
    }
    if ("column".equals(type) || "fieldAndColumn".equals(type)) {
        attributeLookupSettings.setInResults(visible);
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:32,代码来源:StandardGenericXMLSearchableAttribute.java

示例3: isUserAdministrator

import org.kuali.rice.kim.api.group.GroupService; //导入方法依赖的package包/类
/**
   * Implements by calling the is user member of service in KEW's workgroup service, looking for a specific membership
   * in the "NotificationAdmin" workgroup.
   * @see org.kuali.rice.ken.service.NotificationAuthorizationService#isUserAdministrator(java.lang.String)
   */
  public boolean isUserAdministrator(String userId) {
  	String groupNameId = NotificationConstants.KEW_CONSTANTS.NOTIFICATION_ADMIN_GROUP_NAME;
   Person user = KimApiServiceLocator.getPersonService().getPerson(userId);
   if (user == null) {
       return false;
   }

      final GroupService groupService = KimApiServiceLocator.getGroupService();
      Group group = groupService.getGroupByNamespaceCodeAndName(KimConstants.KIM_GROUP_WORKFLOW_NAMESPACE_CODE,
              groupNameId);
return group == null ? false : groupService.isMemberOfGroup(user.getPrincipalId(), group.getId());
  }
 
开发者ID:kuali,项目名称:kc-rice,代码行数:18,代码来源:NotificationAuthorizationServiceImpl.java

示例4: Visibility

import org.kuali.rice.kim.api.group.GroupService; //导入方法依赖的package包/类
Visibility(XPath xpath, Node n) throws XPathExpressionException {
    Boolean visible = null;
    String type = null;
    String groupName = null;
    String groupNamespace = null;
    Node node = (Node) xpath.evaluate("(visibility/field | visibility/column | visibility/fieldAndColumn)", n, XPathConstants.NODE); // NODE - just use first one
    if (node != null && node instanceof Element) {
        Element visibilityEl = (Element) node;
        type = visibilityEl.getNodeName();
        Attr attr = visibilityEl.getAttributeNode("visible");
        if (attr != null) {
            visible = Boolean.valueOf(attr.getValue());
        }
        Node groupMember = (Node) xpath.evaluate("(" + XmlConstants.IS_MEMBER_OF_GROUP + "|" + XmlConstants.IS_MEMBER_OF_WORKGROUP + ")", visibilityEl, XPathConstants.NODE);
        if (groupMember != null && groupMember instanceof Element) {
            Element groupMemberEl = (Element) groupMember;
            boolean group_def_found = false;
            if (XmlConstants.IS_MEMBER_OF_GROUP.equals(groupMember.getNodeName())) {
                group_def_found = true;
                groupName = Utilities.substituteConfigParameters(groupMember.getTextContent().trim());
                groupNamespace = Utilities.substituteConfigParameters(groupMemberEl.getAttribute(XmlConstants.NAMESPACE)).trim();
            } else if (XmlConstants.IS_MEMBER_OF_WORKGROUP.equals(groupMember.getNodeName())) {
                group_def_found = true;
                LOG.warn("Rule Attribute XML is using deprecated element '" + XmlConstants.IS_MEMBER_OF_WORKGROUP +
                         "', please use '" + XmlConstants.IS_MEMBER_OF_GROUP + "' instead.");
                String workgroupName = Utilities.substituteConfigParameters(groupMember.getTextContent());
                groupNamespace = Utilities.parseGroupNamespaceCode(workgroupName);
                groupName = Utilities.parseGroupName(workgroupName);
            }
            if (group_def_found) {
                if (StringUtils.isEmpty(groupName) || StringUtils.isEmpty(groupNamespace)) {
                    throw new RuntimeException("Both group name and group namespace must be present for group-based visibility.");
                }

                GroupService groupService = KimApiServiceLocator.getGroupService();
                Group group = groupService.getGroupByNamespaceCodeAndName(groupNamespace, groupName);
                UserSession session = GlobalVariables.getUserSession();
                if (session != null) {
                 visible =  group == null ? false : groupService.isMemberOfGroup(session.getPerson().getPrincipalId(), group.getId());
                }
            }
        }
    }
    this.visible = visible;
    this.type = type;
    this.groupName = groupName;
    this.groupNamespace = groupNamespace;
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:49,代码来源:XMLSearchableAttributeContent.java


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