Esempio n. 1
0
        public static IEnumerable <string> GetDeleteRoles(PolicyRolesDbContext context)
        {
            var           contextRoles = context.DeleteRoles;
            List <string> deleteRoles  = new List <string>();

            foreach (var role in contextRoles)
            {
                deleteRoles.Add(role.Role);
            }
            return(deleteRoles);
        }
Esempio n. 2
0
        public static string GetDeleteString(PolicyRolesDbContext context)
        {
            var    contextRoles = context.DeleteRoles;
            string deleteRoles  = "";

            foreach (var role in contextRoles)
            {
                deleteRoles += role;
                deleteRoles += ",";
            }
            deleteRoles = deleteRoles.Remove(deleteRoles.Length - 1);
            return(deleteRoles);
        }
Esempio n. 3
0
        public static string GetWriteString(PolicyRolesDbContext context)
        {
            var    contextRoles = context.WriteRoles;
            string writeRoles   = "";

            foreach (var role in contextRoles)
            {
                writeRoles += role;
                writeRoles += ",";
            }
            writeRoles = writeRoles.Remove(writeRoles.Length - 1);
            return(writeRoles);
        }
Esempio n. 4
0
        public static bool IsInDeleteRole(IList <string> roles, PolicyRolesDbContext context)
        {
            bool inList = false;
            IEnumerable <string> DeleteRoles = GetDeleteRoles(context);

            foreach (var role in roles)
            {
                var result = DeleteRoles.Contains(role);
                if (result)
                {
                    inList = true;
                    break;
                }
            }
            return(inList);
        }