Ejemplo n.º 1
0
        private void ListRoleItems()
        {
            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable       results   = base.ServiceBroker.ServicePackage.ResultTable;
            UserRoleManager urmServer = new UserRoleManager();

            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(base.BaseAPIConnectionString);
                Role role = urmServer.GetRole(base.GetStringProperty(Constants.SOProperties.Role.RoleName, true));
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
                }
                RoleItemCollection <Role, RoleItem> items = role.Include;
                foreach (RoleItem ri in items)
                {
                    DataRow row = results.NewRow();
                    results.Rows.Add(FillRoleItemRow(row, ri, false));
                }
                items = role.Exclude;
                foreach (RoleItem ri in items)
                {
                    DataRow row = results.NewRow();
                    results.Rows.Add(FillRoleItemRow(row, ri, true));
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  delete role
        /// </summary>
        /// <param name="roleName">role name</param>
        public static void DeleteRole(string roleName)
        {
            UserRoleManager roleManager = new UserRoleManager();

            try
            {
                roleManager.CreateConnection();
                roleManager.Connection.Open(GetServerConnectionSetup());
                Role role = roleManager.GetRole(roleName);
                if (role != null)
                {
                    roleManager.DeleteRole(role.Guid, roleName);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (roleManager != null)
                {
                    roleManager.Connection.Close();
                    roleManager.Connection.Dispose();
                    roleManager.DeleteConnection();
                    roleManager.Connection = null;
                    roleManager            = null;
                }
            }
        }
Ejemplo n.º 3
0
        private void DeleteRoleItem()
        {
            ServiceObject serviceObject = this.ServiceBroker.Service.ServiceObjects[0];

            serviceObject.Properties.InitResultTable();

            string          roleName  = base.GetStringProperty(Constants.SOProperties.Role.RoleName, true);
            UserRoleManager urmServer = new UserRoleManager();

            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(base.BaseAPIConnectionString);
                Role role = urmServer.GetRole(roleName);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
                }

                string   roleItemName = base.GetStringProperty(Constants.SOProperties.Role.RoleItem, true);
                RoleItem remItem      = null;

                foreach (RoleItem ri in role.RoleItems)
                {
                    if (string.Compare(ri.Name, roleItemName, true) == 0)
                    {
                        remItem = ri;
                    }
                }
                if (remItem != null)
                {
                    role.RoleItems.Remove(remItem);
                }
                urmServer.UpdateRole(role);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///  Get users of role by role name
        /// </summary>
        /// <param name="roleName">role name</param>
        /// <returns>return users</returns>
        public static string[] GetRoleUsers(string roleName)
        {
            UserRoleManager roleManager = new UserRoleManager();

            try
            {
                roleManager.CreateConnection();
                roleManager.Connection.Open(GetServerConnectionSetup());
                Role     role  = roleManager.GetRole(roleName);
                string[] names = new string[role.Include.Count];
                for (int i = 0; i < role.Include.Count; i++)
                {
                    names[i] = role.Include[i].Name;
                }

                return(names);
            }
            catch
            {
                throw;
            }
            finally
            {
                if (roleManager != null)
                {
                    roleManager.Connection.Close();
                    roleManager.Connection.Dispose();
                    roleManager.DeleteConnection();
                    roleManager.Connection = null;
                    roleManager            = null;
                }
            }
        }
Ejemplo n.º 5
0
        private void AddRoleItem()
        {
            ServiceObject serviceObject = this.ServiceBroker.Service.ServiceObjects[0];

            serviceObject.Properties.InitResultTable();


            UserRoleManager urmServer = new UserRoleManager();

            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(base.BaseAPIConnectionString);
                Role role = urmServer.GetRole(base.GetStringProperty(Constants.SOProperties.Role.RoleName, true));
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
                }
                string roleItemName = base.GetStringProperty(Constants.SOProperties.Role.RoleItem, true);
                string roleItemType = base.GetStringProperty(Constants.SOProperties.Role.RoleItemType, true);
                bool   exclude      = base.GetBoolProperty(Constants.SOProperties.Role.RoleExclude);
                switch (roleItemType.ToUpper())
                {
                case "GROUP":
                    GroupItem gi = new GroupItem(roleItemName);
                    if (exclude)
                    {
                        role.Exclude.Add(gi);
                    }
                    else
                    {
                        role.Include.Add(gi);
                    }
                    break;

                case "USER":
                    UserItem ui = new UserItem(roleItemName);
                    if (exclude)
                    {
                        role.Exclude.Add(ui);
                    }
                    else
                    {
                        role.Include.Add(ui);
                    }
                    break;

                default:
                    throw new ApplicationException(string.Format(Constants.ErrorMessages.RoleTypeNotSupported, roleItemType));
                    //break;
                }
                urmServer.UpdateRole(role);
            }
        }
Ejemplo n.º 6
0
        /// <summary>
        ///  create a role
        /// </summary>
        /// <param name="roleName">role name</param>
        /// <param name="roleDescription">roleDescription's description</param>
        /// <param name="users">user ad's</param>
        public static void CreateRole(string roleName, string roleDescription, string users)
        {
            if (string.IsNullOrEmpty(users))
            {
                return;
            }

            SourceCode.Security.UserRoleManager.Management.UserRoleManager roleManager = new UserRoleManager();

            try
            {
                roleManager.CreateConnection();
                roleManager.Connection.Open(GetServerConnectionSetup());
                if (roleManager.GetRole(roleName) == null)
                {
                    SourceCode.Security.UserRoleManager.Management.Role role = new SourceCode.Security.UserRoleManager.Management.Role();

                    // Set Role Name, Description and Properties
                    role.Name        = roleName;
                    role.Description = roleDescription;
                    role.IsDynamic   = true;

                    ////Add users to Include in Role
                    ////role.Include.Add(new UserItem("K2:DENALLIX\\Anthony"));
                    string[] user = users.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string u in user)
                    {
                        string us = SecurityLabelName + ":" + u;
                        if (role.Include[us] == null)
                        {
                            role.Include.Add(new UserItem(us));
                        }
                    }

                    roleManager.CreateRole(role);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (roleManager != null)
                {
                    roleManager.Connection.Close();
                    roleManager.Connection.Dispose();
                    roleManager.DeleteConnection();
                    roleManager.Connection = null;
                    roleManager            = null;
                }
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        ///  Add users to a role
        /// </summary>
        /// <param name="roleName">role name</param>
        /// <param name="users">user ad's</param>
        public static void AddUsersToRole(string roleName, string users)
        {
            SourceCode.Security.UserRoleManager.Management.UserRoleManager roleManager = new UserRoleManager();

            try
            {
                roleManager.CreateConnection();
                roleManager.Connection.Open(GetServerConnectionSetup());

                SourceCode.Security.UserRoleManager.Management.Role role = roleManager.GetRole(roleName);

                ////Add users to Include in Role
                ////role.Include.Add(new UserItem("K2:DENALLIX\\Anthony"));
                if (role != null)
                {
                    string[] user = users.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string u in user)
                    {
                        string us = SecurityLabelName + ":" + u;
                        if (role.Include[us] == null)
                        {
                            role.Include.Add(new UserItem(us));
                        }
                    }

                    roleManager.UpdateRole(role);
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (roleManager != null)
                {
                    roleManager.Connection.Close();
                    roleManager.Connection.Dispose();
                    roleManager.DeleteConnection();
                    roleManager.Connection = null;
                    roleManager            = null;
                }
            }
        }
Ejemplo n.º 8
0
        private void ListRoleItems()
        {
            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable       results   = base.ServiceBroker.ServicePackage.ResultTable;
            UserRoleManager urmServer = this.ServiceBroker.K2Connection.GetConnection <UserRoleManager>();

            using (urmServer.Connection)
            {
                Role role = urmServer.GetRole(base.GetStringProperty(Constants.SOProperties.Role.RoleName, true));
                if (role == null)
                {
                    throw new ApplicationException(Resources.RoleNotExists);
                }
                foreach (RoleItem ri in role.RoleItems)
                {
                    DataRow row = results.NewRow();
                    results.Rows.Add(FillRoleItemRow(row, ri));
                }
            }
        }
Ejemplo n.º 9
0
        private void DeleteRole()
        {
            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable       results   = base.ServiceBroker.ServicePackage.ResultTable;
            UserRoleManager urmServer = this.ServiceBroker.K2Connection.GetConnection <UserRoleManager>();

            using (urmServer.Connection)
            {
                string roleName = base.GetStringProperty(Constants.SOProperties.Role.RoleName, true);
                Role   role     = urmServer.GetRole(roleName);
                if (role == null)
                {
                    throw new ApplicationException(Resources.RoleNotExists);
                }
                else
                {
                    urmServer.DeleteRole(role.Guid, role.Name);
                    urmServer.Connection.Close();
                }
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        ///  delete users of role
        /// </summary>
        /// <param name="roleName">role name</param>
        /// <param name="users">user ad's</param>
        public static void DeleteUserFromRole(string roleName, string users)
        {
            UserRoleManager roleManager = new UserRoleManager();

            try
            {
                roleManager.CreateConnection();
                roleManager.Connection.Open(GetServerConnectionSetup());
                Role role = roleManager.GetRole(roleName);
                if (role != null)
                {
                    string[] user = users.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (string u in user)
                    {
                        role.Include.Remove(role.Include[SecurityLabelName + ":" + u]);
                    }

                    roleManager.UpdateRole(role);
                    roleManager.Connection.Dispose();
                    roleManager.DeleteConnection();
                    roleManager.Connection = null;
                    roleManager            = null;
                }
            }
            catch
            {
                throw;
            }
            finally
            {
                if (roleManager != null)
                {
                    roleManager.Connection.Close();
                    roleManager.Connection.Dispose();
                    roleManager.DeleteConnection();
                    roleManager.Connection = null;
                    roleManager            = null;
                }
            }
        }
Ejemplo n.º 11
0
        private void DeleteRole()
        {
            base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
            DataTable       results   = base.ServiceBroker.ServicePackage.ResultTable;
            UserRoleManager urmServer = new UserRoleManager();

            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(base.BaseAPIConnectionString);
                string roleName = base.GetStringProperty(Constants.SOProperties.Role.RoleName, true);
                Role   role     = urmServer.GetRole(roleName);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
                }
                else
                {
                    urmServer.DeleteRole(role.Guid, role.Name);
                    urmServer.Connection.Close();
                }
            }
        }
Ejemplo n.º 12
0
        private void AddRoleItem()
        {
            ServiceObject serviceObject = this.ServiceBroker.Service.ServiceObjects[0];

            serviceObject.Properties.InitResultTable();


            UserRoleManager urmServer = this.ServiceBroker.K2Connection.GetConnection <UserRoleManager>();

            using (urmServer.Connection)
            {
                Role role = urmServer.GetRole(base.GetStringProperty(Constants.SOProperties.Role.RoleName, true));
                if (role == null)
                {
                    throw new ApplicationException(Resources.RoleNotExists);
                }
                string   roleItemName = base.GetStringProperty(Constants.SOProperties.Role.RoleItem, true);
                string   roleItemType = base.GetStringProperty(Constants.SOProperties.Role.RoleItemType, true);
                RoleItem ri;
                switch (roleItemType.ToUpper())
                {
                case "GROUP":
                    ri = new GroupItem(roleItemName);
                    break;

                case "USER":
                    ri = new UserItem(roleItemName);
                    break;

                default:
                    throw new ApplicationException(string.Format(Resources.RoleTypeNotSupported, roleItemType));
                    //break;
                }
                role.RoleItems.Add(ri);

                urmServer.UpdateRole(role);
            }
        }
Ejemplo n.º 13
0
 private void ListRoleItems()
 {
     base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
     DataTable results = base.ServiceBroker.ServicePackage.ResultTable;
     UserRoleManager urmServer = new UserRoleManager();
     using (urmServer.CreateConnection())
     {
         urmServer.Connection.Open(base.BaseAPIConnectionString);
         Role role = urmServer.GetRole(base.GetStringProperty(Constants.SOProperties.Role.RoleName, true));
         if (role == null)
         {
             throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
         }
         RoleItemCollection<Role, RoleItem> items = role.Include;
         foreach (RoleItem ri in items)
         {
             DataRow row = results.NewRow();
             results.Rows.Add(FillRoleItemRow(row, ri, false));
         }
         items = role.Exclude;
         foreach (RoleItem ri in items)
         {
             DataRow row = results.NewRow();
             results.Rows.Add(FillRoleItemRow(row, ri, true));
         }
     }
 }
        private void FindUserInRole()
        {
            ServiceObject serviceObject = this.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();

            DataTable results = this.ServicePackage.ResultTable;
            DataRow row;
            bool isRoleMember = false;

            UserRoleManager urmServer = new UserRoleManager();
            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(WFMServerConnectionString);
                Role role = urmServer.GetRole(serviceObject.Properties[Constants.Properties.RoleName].Value as string);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorText.RoleNotExist);
                }

                foreach (RoleItem roleItem in role.Include)
                {
                    string roleItemName = roleItem.Name;

                    if (roleItem is UserItem)
                    {
                        // check if the specified username matches the current roleItem name
                        if (serviceObject.Properties[Constants.Properties.RoleItem].Value.ToString() == roleItem.Name)
                        {
                            // user exist in role
                            row = results.NewRow();
                            results.Rows.Add(FillResultRow(row, true));
                            isRoleMember = true;
                            break;
                        }
                    }
                    else
                    {
                        // It is a group item, use the smartobject method UMUser.Get_Group_Users to resolve all group users  
                        
                        // Open a K2 Server connection
                        smartobjectClient.SmartObjectClientServer smoServer = new smartobjectClient.SmartObjectClientServer();
                        smoServer.CreateConnection();
                        smoServer.Connection.Open(WFMServerConnectionString);

                        // Get a handle to the ' UMUser' SmartObject
                        smartobjectClient.SmartObject umUser = smoServer.GetSmartObject("UMUser");

                        // Specify which method will be called
                        smartobjectClient.SmartListMethod getGroupUsers = umUser.ListMethods["Get_Group_Users"];
                        umUser.MethodToExecute = getGroupUsers.Name;

                        // Split FQN in SecurityLabel and groupname
                        string[] fqn = roleItem.Name.Split(':');
                        
                        // Set the input properties
                        getGroupUsers.InputProperties["Labelname"].Value = fqn[0];
                        getGroupUsers.InputProperties["Group_name"].Value = fqn[1];

                        // Call the method
                        smartobjectClient.SmartObjectList smartObjectGroupUsers = smoServer.ExecuteList(umUser);

                        List<string> groupUsers = new List<string>();

                        foreach (smartobjectClient.SmartObject smo in smartObjectGroupUsers.SmartObjectsList)
                        {
                            groupUsers.Add(smo.Properties["FQN"].Value);
                        }

                        foreach (string user in groupUsers)
                        {
                            // check if the specified username matches the current roleItem name
                            if (serviceObject.Properties[Constants.Properties.RoleItem].Value.ToString() == user)
                            {
                                // user exist in role
                                row = results.NewRow();
                                results.Rows.Add(FillResultRow(row, true));
                                isRoleMember = true;
                                break;
                            }
                        }
                    }
                }

                // the specified user is not found in the specified role
                if (!isRoleMember)
                {
                    row = results.NewRow();
                    results.Rows.Add(FillResultRow(row, false));
                }
            }
        }
Ejemplo n.º 15
0
 private void DeleteRole()
 {
     base.ServiceBroker.Service.ServiceObjects[0].Properties.InitResultTable();
     DataTable results = base.ServiceBroker.ServicePackage.ResultTable;
     UserRoleManager urmServer = new UserRoleManager();
     using (urmServer.CreateConnection())
     {
         urmServer.Connection.Open(base.BaseAPIConnectionString);
         string roleName = base.GetStringProperty(Constants.SOProperties.Role.RoleName, true);
         Role role = urmServer.GetRole(roleName);
         if (role == null)
         {
             throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
         }
         else
         {
             urmServer.DeleteRole(role.Guid, role.Name);
             urmServer.Connection.Close();
         }
     }
 }
Ejemplo n.º 16
0
        private void DeleteRoleItem()
        {
            ServiceObject serviceObject = this.ServiceBroker.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();

            string roleName = base.GetStringProperty(Constants.SOProperties.Role.RoleName, true);
            UserRoleManager urmServer = new UserRoleManager();
            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(base.BaseAPIConnectionString);
                Role role = urmServer.GetRole(roleName);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
                }

                string roleItemName = base.GetStringProperty(Constants.SOProperties.Role.RoleItem, true);
                RoleItem remItem = null;
                foreach (RoleItem ri in role.Include)
                {
                    if (string.Compare(ri.Name, roleItemName, true) == 0)
                        remItem = ri;
                }
                if (remItem != null)
                {
                    role.Include.Remove(remItem);
                }
                else
                {
                    foreach (RoleItem ri in role.Exclude)
                    {
                        if (string.Compare(ri.Name, roleItemName, true) == 0)
                        {
                            remItem = ri;
                        }
                    }
                    if (remItem != null)
                    {
                        role.Exclude.Remove(remItem);
                    }
                }
                urmServer.UpdateRole(role);
            }
        }
Ejemplo n.º 17
0
        private void AddRoleItem()
        {
            ServiceObject serviceObject = this.ServiceBroker.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();

            UserRoleManager urmServer = new UserRoleManager();
            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(base.BaseAPIConnectionString);
                Role role = urmServer.GetRole(base.GetStringProperty(Constants.SOProperties.Role.RoleName,true));
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorMessages.RoleNotExists);
                }
                string roleItemName = base.GetStringProperty(Constants.SOProperties.Role.RoleItem, true);
                string roleItemType = base.GetStringProperty(Constants.SOProperties.Role.RoleItemType, true);
                bool exclude = base.GetBoolProperty(Constants.SOProperties.Role.RoleExclude);
                switch (roleItemType.ToUpper())
                {
                    case "GROUP":
                        GroupItem gi = new GroupItem(roleItemName);
                        if (exclude)
                            role.Exclude.Add(gi);
                        else
                            role.Include.Add(gi);
                        break;
                    case "USER":
                        UserItem ui = new UserItem(roleItemName);
                        if (exclude)
                            role.Exclude.Add(ui);
                        else
                            role.Include.Add(ui);
                        break;
                    default:
                        throw new ApplicationException(string.Format(Constants.ErrorMessages.RoleTypeNotSupported, roleItemType));
                    //break;
                }
                urmServer.UpdateRole(role);
            }
        }
        private void DeleteRoleItem()
        {
            ServiceObject serviceObject = this.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();

            UserRoleManager urmServer = new UserRoleManager();
            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(WFMServerConnectionString);
                Role role = urmServer.GetRole(serviceObject.Properties[Constants.Properties.RoleName].Value as string);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorText.RoleNotExist);
                }

                string roleItemName = serviceObject.Properties[Constants.Properties.RoleItem].Value as string;
                RoleItem remItem = null;
                foreach (RoleItem ri in role.Include)
                {
                    if (string.Compare(ri.Name, roleItemName, true) == 0)
                        remItem = ri;
                }

                if (remItem != null)
                    role.Include.Remove(remItem);
                else
                {
                    foreach (RoleItem ri in role.Exclude)
                    {
                        if (string.Compare(ri.Name, roleItemName, true) == 0)
                            remItem = ri;
                    }

                    if (remItem != null)
                        role.Exclude.Remove(remItem);
                }
                urmServer.UpdateRole(role);
            }
        }
        private void AddRoleItem()
        {
            ServiceObject serviceObject = this.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();

            UserRoleManager urmServer = new UserRoleManager();
            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(WFMServerConnectionString);
                Role role = urmServer.GetRole(serviceObject.Properties[Constants.Properties.RoleName].Value as string);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorText.RoleNotExist);
                }
                string roleItemName = serviceObject.Properties[Constants.Properties.RoleItem].Value as string;
                string roleItemType = serviceObject.Properties[Constants.Properties.RoleItemType].Value as string;
                bool exclude = Convert.ToBoolean(serviceObject.Properties[Constants.Properties.RoleExclude].Value as string);

                switch (roleItemType)
                {
                    case Constants.RoleItemType.Group:
                        GroupItem gi = new GroupItem(roleItemName);
                        if (exclude)
                            role.Exclude.Add(gi);
                        else 
                            role.Include.Add(gi);
                        break;
                    case Constants.RoleItemType.User:
                        UserItem ui = new UserItem(roleItemName);
                        if (exclude)
                            role.Exclude.Add(ui);
                        else 
                            role.Include.Add(ui);
                        break;
 
                    default:
                        throw new ApplicationException(string.Format(Constants.ErrorText.RoleTypeNotSupported, roleItemType));
                        //break;
                }

                urmServer.UpdateRole(role);
            }
        }
        private void ListRoleItems()
        {
            ServiceObject serviceObject = this.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();

            DataTable results = this.ServicePackage.ResultTable;

            UserRoleManager urmServer = new UserRoleManager();
            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(WFMServerConnectionString);
                Role role = urmServer.GetRole(serviceObject.Properties[Constants.Properties.RoleName].Value as string);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorText.RoleNotExist);
                }
                RoleItemCollection<Role, RoleItem> items = role.Include;
                foreach (RoleItem ri in items)
                {
                    DataRow row = results.NewRow();
                    results.Rows.Add(FillRoleItemRow(row, ri, false));
                }

                items = role.Exclude;
                foreach (RoleItem ri in items)
                {
                    DataRow row = results.NewRow();
                    results.Rows.Add(FillRoleItemRow(row, ri, true));
                }
            }
        }
        private void DeleteRole()
        {
            ServiceObject serviceObject = this.Service.ServiceObjects[0];
            serviceObject.Properties.InitResultTable();

            UserRoleManager urmServer = new UserRoleManager();

            using (urmServer.CreateConnection())
            {
                urmServer.Connection.Open(WFMServerConnectionString);

                string roleName = serviceObject.Properties[Constants.Properties.RoleName].Value as string;
                Guid roleGUID = new Guid(serviceObject.Properties[Constants.Properties.RoleGuid].Value as string);

                Role role = urmServer.GetRole(roleName);
                if (role == null)
                {
                    throw new ApplicationException(Constants.ErrorText.RoleNotExist);
                }
                else
                {
                    urmServer.DeleteRole(roleGUID, roleName);
                    urmServer.Connection.Close();
                }
            }
        }