I did see that. I appreciate your help and the URL, I guess I don't
understand.
I thought the service def folder had xml saying what services are available,
but I do not understand looking at this XML where the actual service is, or
maybe the xml actually does the work?
I found that in the service def folder, not the script.
I do not understand how that bit there adds a record to the table.

I ended up doing my own java function (hard coded to add the group to
fulladmin):

        public static String addUserLoginToSecurityGroup(HttpServletRequest
request,String partyId) {
                GenericDelegator delegator = (GenericDelegator) request
                                .getAttribute("delegator");
        boolean useEncryption = true;
        String userLoginId = partyId;
        String currentPassword = partyId;
        String groupId = "FULLADMIN";
        Timestamp now = UtilDateTime.nowTimestamp();
        GenericValue userLoginSecurityGroupToCreate =
delegator.makeValue("UserLoginSecurityGroup", UtilMisc.toMap("userLoginId",
userLoginId,"groupId",groupId, "fromDate",now));
        try {
            EntityCondition condition =
EntityCondition.makeCondition(EntityFunction.UPPER_FIELD("userLoginId"),
EntityOperator.EQUALS, EntityFunction.UPPER(userLoginId));
            if
(UtilValidate.isNotEmpty(delegator.findList("UserLoginSecurityGroup",
condition, null, null, null, false))) {
                Map<String, String> messageMap =
UtilMisc.toMap("userLoginId", userLoginId);
              return "found security group for user";
            }
        } catch (GenericEntityException e) {
            return "user login already in security group";
        }
        //not there so create security group for userlogin
        try {
            userLoginSecurityGroupToCreate.create();
        } catch (GenericEntityException e) {
            Debug.logWarning(e, "", module);
            Map<String, String> messageMap = UtilMisc.toMap("errorMessage",
e.getMessage());
              return "error";
        }
        return "created security group for login user :"+partyId;
    }// addUserLoginToSecurityGroup




-----
Joel Fradkin
--
View this message in context: 
http://ofbiz.135035.n4.nabble.com/adding-a-user-login-to-a-security-group-tp4656265p4656310.html
Sent from the OFBiz - User mailing list archive at Nabble.com.

Reply via email to