Esempio n. 1
0
        public static object[] GetRoles(BPMConnection cn, string memberFullName)
        {
            List <object> rv = new List <object>();

            BPMObjectNameCollection roleSids = SecurityManager.GetMemberRoleSIDs(cn, memberFullName);

            foreach (string sid in roleSids)
            {
                string dept     = null;
                string roleName = SecurityManager.TryGetObjectNameFromSID(cn, SIDType.RoleSID, sid);
                if (String.IsNullOrEmpty(roleName))
                {
                    roleName = sid;
                }
                else
                {
                    Role role = new Role();
                    role.Open(cn, roleName);
                    roleName = role.Name;
                    OU ou = role.GetParentOU(cn);
                    dept = ou.GetFriendlyFullName(cn);
                }

                rv.Add(
                    new
                {
                    ou       = dept,
                    RoleName = roleName
                }
                    );
            }

            return(rv.ToArray());
        }