public static SecuritySystemRole AddMemberAccessPermissionFluent <T>(this SecuritySystemRole securityRole, string members, SecurityOperationsFluentExtension securityOperation, string criteria = null)
        {
            if (String.IsNullOrEmpty(members))
            {
                throw new ArgumentNullException(String.Format("Members arguments (Role {0} Type {1} ) is null or empty", securityRole.Name, typeof(T).FullName));
            }

            if (typeof(T).IsInterface)
            {
                foreach (var type in GetListTypesFromInterface(typeof(T), securityRole.GetType()))
                {
                    if (String.IsNullOrEmpty(criteria))
                    {
                        securityRole.AddMemberAccessPermission(type, members, GetDescriptionAttribute(securityOperation));
                    }
                    else
                    {
                        securityRole.AddMemberAccessPermission(type, members, GetDescriptionAttribute(securityOperation), criteria);
                    }
                }

                return(securityRole);
            }

            if (String.IsNullOrEmpty(criteria))
            {
                securityRole.AddMemberAccessPermission <T>(members, GetDescriptionAttribute(securityOperation));
            }
            else
            {
                securityRole.AddMemberAccessPermission <T>(members, GetDescriptionAttribute(securityOperation), criteria);
            }

            return(securityRole);
        }
        public static SecuritySystemRole AddTypePermissionFluent <T>(this SecuritySystemRole securityRole, SecurityOperationsFluentExtension securityOperation)
        {
            if (typeof(T).IsInterface)
            {
                foreach (var type in GetListTypesFromInterface(typeof(T), securityRole.GetType()))
                {
                    securityRole.SetTypePermissions(type, GetDescriptionAttribute(securityOperation), DevExpress.ExpressApp.Security.Strategy.SecuritySystemModifier.Allow);
                }

                return(securityRole);
            }

            securityRole.SetTypePermissions <T>(GetDescriptionAttribute(securityOperation), SecuritySystemModifier.Allow);
            return(securityRole);
        }
 public static SecuritySystemRole AddTypePermissionFluent(this SecuritySystemRole securityRole, List <Type> typeList, SecurityOperationsFluentExtension securityOperation)
 {
     foreach (var type in typeList)
     {
         if (type.IsInterface)
         {
             foreach (var classType in GetListTypesFromInterface(type, securityRole.GetType()))
             {
                 securityRole.SetTypePermissions(classType, GetDescriptionAttribute(securityOperation), SecuritySystemModifier.Allow);
             }
             continue;
         }
         securityRole.SetTypePermissions(type, GetDescriptionAttribute(securityOperation), SecuritySystemModifier.Allow);
     }
     return(securityRole);
 }
        public static SecuritySystemRole AddObjectAccessPermissionFluent <T>(this SecuritySystemRole securityRole, SecurityOperationsFluentExtension securityOperation, string criteria)
        {
            if (String.IsNullOrEmpty(criteria))
            {
                throw new ArgumentNullException("SecurityOperations or criteria arguments is null or empty");
            }

            if (typeof(T).IsInterface)
            {
                foreach (var type in GetListTypesFromInterface(typeof(T), securityRole.GetType()))
                {
                    securityRole.AddObjectAccessPermission(type, criteria, GetDescriptionAttribute(securityOperation));
                }

                return(securityRole);
            }

            securityRole.AddObjectAccessPermission <T>(criteria, GetDescriptionAttribute(securityOperation));
            return(securityRole);
        }
        public static SecuritySystemRole AddMemberAccessPermissionFluent(this SecuritySystemRole securityRole, List <Type> typeList, string members, SecurityOperationsFluentExtension securityOperation, string criteria = null)
        {
            if (String.IsNullOrEmpty(members))
            {
                throw new ArgumentNullException(String.Format("Members arguments (EmployeeRole {0} list types ) is null or empty", securityRole.Name));
            }

            foreach (var type in typeList)
            {
                if (type.IsInterface)
                {
                    foreach (var classType in GetListTypesFromInterface(type, securityRole.GetType()))
                    {
                        if (String.IsNullOrEmpty(criteria))
                        {
                            securityRole.AddMemberAccessPermission(classType, members, GetDescriptionAttribute(securityOperation));
                        }
                        else
                        {
                            securityRole.AddMemberAccessPermission(classType, members, GetDescriptionAttribute(securityOperation), criteria);
                        }
                    }
                    continue;
                }

                if (String.IsNullOrEmpty(criteria))
                {
                    securityRole.AddMemberAccessPermission(type, members, GetDescriptionAttribute(securityOperation));
                }
                else
                {
                    securityRole.AddMemberAccessPermission(type, members, GetDescriptionAttribute(securityOperation), criteria);
                }
            }

            return(securityRole);
        }