本文整理汇总了Java中org.kuali.rice.kim.api.group.GroupService.isMemberOfGroup方法的典型用法代码示例。如果您正苦于以下问题:Java GroupService.isMemberOfGroup方法的具体用法?Java GroupService.isMemberOfGroup怎么用?Java GroupService.isMemberOfGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.kuali.rice.kim.api.group.GroupService
的用法示例。
在下文中一共展示了GroupService.isMemberOfGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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());
}
示例3: 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;
}