public Permission Add(string name, ILocalizableString displayName = null, ILocalizableString description = null, MultiTenancySides multiTenancySides = MultiTenancySides.Tenant | MultiTenancySides.Host)
        {
            var permission = new Permission(name, displayName, displayName, multiTenancySides);

            permissions.Add(name, permission);
            return(permission);
        }
Beispiel #2
0
        /// <summary>
        ///     Creates a new <see cref="MenuItemDefinition" /> object.
        /// </summary>
        public MenuItemDefinition(
            string name,
            ILocalizableString displayName,
            string icon = null,
            string url  = null,
            bool requiresAuthentication   = false,
            string requiredPermissionName = null,
            IPermissionDependency permissionDependency = null,
            int order         = 0,
            object customData = null,
            IFeatureDependency featureDependency = null,
            string target  = null,
            bool isEnabled = true,
            bool isVisible = true)
        {
            Check.NotNull(name, nameof(name));
            Check.NotNull(displayName, nameof(displayName));

            Name                   = name;
            DisplayName            = displayName;
            Icon                   = icon;
            Url                    = url;
            RequiresAuthentication = requiresAuthentication;
            RequiredPermissionName = requiredPermissionName;
            PermissionDependency   = permissionDependency;
            Order                  = order;
            CustomData             = customData;
            FeatureDependency      = featureDependency;
            Target                 = target;
            IsEnabled              = isEnabled;
            IsVisible              = isVisible;

            Items = new List <MenuItemDefinition>();
        }
 public Abp.Authorization.Permission EditPermission(string oldName, Abp.Authorization.Permission parent, string name, ILocalizableString displayName = null,
                                                    ILocalizableString description       = null,
                                                    MultiTenancySides multiTenancySides  = MultiTenancySides.Tenant | MultiTenancySides.Host,
                                                    IFeatureDependency featureDependency = null, Dictionary <string, object> properties = null)
 {
     throw new NotImplementedException();
 }
        /// <summary>
        /// Creates a new permission under this group.
        /// </summary>
        /// <param name="name">Unique name of the permission</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="isGrantedByDefault">Is this permission granted by default. Default value: false.</param>
        /// <param name="description">A brief description for this permission</param>
        /// <returns>New created permission</returns>
        public Permission CreatePermission(string name, ILocalizableString displayName, bool isGrantedByDefault = false, ILocalizableString description = null)
        {
            var permission = new Permission(name, displayName, isGrantedByDefault, description);

            _permissions.Add(permission);
            return(permission);
        }
Beispiel #5
0
        /// <summary>
        /// Creates a new <see cref="SettingDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting</param>
        /// <param name="defaultValue">Default value of the setting</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="group">Group of this setting</param>
        /// <param name="description">A brief description for this setting</param>
        /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
        /// <param name="isInherited">Is this setting inherited from parent scopes. Default: True.</param>
        /// <param name="customData">Can be used to store a custom object related to this setting</param>
        /// <param name="clientVisibilityProvider">Client visibility definition for the setting. Default: invisible</param>
        public SettingDefinition(
            string name,
            string defaultValue,
            ILocalizableString displayName = null,
            SettingDefinitionGroup group   = null,
            ILocalizableString description = null,
            SettingScopes scopes           = SettingScopes.Application,
            bool isInherited  = true,
            object customData = null,
            ISettingClientVisibilityProvider clientVisibilityProvider = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            Name                     = name;
            DefaultValue             = defaultValue;
            DisplayName              = displayName;
            Group                    = group;
            Description              = description;
            Scopes                   = scopes;
            IsInherited              = isInherited;
            CustomData               = customData;
            ClientVisibilityProvider =
                clientVisibilityProvider ?? new HiddenSettingClientVisibilityProvider();
        }
Beispiel #6
0
 ///GENMHASH:F886A4914B553C095A7AE17389D27E77:FA5F578A5F3D9A0CDDD31A0A42192F9F
 internal MetricDefinitionImpl(MetricDefinition innerModel, MonitorManager monitorManager)
     : base(innerModel)
 {
     this.myManager = monitorManager;
     this.inner     = innerModel;
     this.name      = (inner.Name == null) ? null : new LocalizableStringImpl(inner.Name);
 }
Beispiel #7
0
        /// <param name="name"></param>
        /// <param name="displayName"></param>
        /// <param name="icon"></param>
        /// <param name="url"></param>
        /// <param name="requiresAuthentication"></param>
        /// <param name="PermissionNames">This parameter is obsolete. Use <paramref name="permissionDependency"/> instead!</param>
        /// <param name="order"></param>
        /// <param name="customData"></param>
        /// <param name="featureDependency"></param>
        /// <param name="target"></param>
        /// <param name="isEnabled"></param>
        /// <param name="isVisible"></param>
        /// <param name="permissionDependency"></param>
        public NavigationItemDefinition(
            string name,
            ILocalizableString displayName,
//            string url = null,
            bool requiresAuthentication  = false,
            Permission[] permissionNames = null,
            object customData            = null,
            //     IFeatureDependency featureDependency = null,
            //    bool isEnabled = true,
            bool isVisible = true,
            IPermissionDependency permissionDependency = null
            )
        {
            Check.NotNull(name, nameof(name));
            Check.NotNull(displayName, nameof(displayName));

            Name                   = name;
            DisplayName            = displayName;
            RequiresAuthentication = requiresAuthentication;
            HasPermissions         = permissionNames;
            //   RequiredPermissionName = HasPermissions;
            CustomData = customData;
            // FeatureDependency = featureDependency;
            //   IsEnabled = isEnabled;
            IsVisible = isVisible;
            //  PermissionDependency = permissionDependency;
//            Items = new List<INavigationItemDefinition>();
        }
        /// <summary>
        /// Creates a new <see cref="SettingDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting</param>
        /// <param name="defaultValue">Default value of the setting</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="group">Group of this setting</param>
        /// <param name="description">A brief description for this setting</param>
        /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
        /// <param name="isVisibleToClients">Can clients see this setting and it's value. Default: false</param>
        /// <param name="isInherited">Is this setting inherited from parent scopes. Default: True.</param>
        /// <param name="customData">Can be used to store a custom object related to this setting</param>
        public SettingDefinition(
            string name, 
            string defaultValue, 
            ILocalizableString displayName = null, 
            SettingDefinitionGroup group = null, 
            ILocalizableString description = null, 
            SettingScopes scopes = SettingScopes.Application, 
            bool isVisibleToClients = false, 
            bool isInherited = true,
            object customData = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            Name = name;
            DefaultValue = defaultValue;
            DisplayName = displayName;
            Group = @group;
            Description = description;
            Scopes = scopes;
            IsVisibleToClients = isVisibleToClients;
            IsInherited = isInherited;
            CustomData = customData;
        }
Beispiel #9
0
        /// <summary>
        /// Creates a new menu entry
        /// </summary>
        private MenuItemDefinition CreateMenuItem(
            string name,
            ILocalizableString displayName,
            string url  = null,
            string icon = null,
            string requiredPermissions = null,
            string templateUrl         = null,
            string routeUrl            = null,
            bool hidden = false)
        {
            var data = new
            {
                templateUrl = templateUrl,
                hidden      = hidden,
                routeUrl    = routeUrl
            };

            return(new MenuItemDefinition(
                       name,
                       displayName,
                       url: (!string.IsNullOrWhiteSpace(url) ? url : null),
                       icon: (!string.IsNullOrWhiteSpace(icon) ? icon : null),
                       requiredPermissionName: (!string.IsNullOrWhiteSpace(requiredPermissions) ? requiredPermissions : null),
                       customData: data
                       ));
        }
    public IViewComponentResult Invoke(
        ILocalizableString text,
        string name,
        string icon,
        string id,
        ILocalizableString busyText,
        FontIconType iconType,
        AbpButtonType type,
        AbpButtonSize size,
        bool disabled)
    {
        Check.NotNull(text, nameof(text));

        return(View(
                   "~/Pages/Shared/Components/AbpPageToolbar/Button/Default.cshtml",
                   new AbpPageToolbarButtonViewModel(
                       text.Localize(StringLocalizerFactory),
                       name,
                       icon,
                       id,
                       busyText?.Localize(StringLocalizerFactory),
                       iconType,
                       type,
                       size,
                       disabled
                       )
                   ));
    }
        /// <summary>
        /// Creates a new <see cref="MenuItemDefinition"/> object.
        /// </summary>
        public MenuItemDefinition(
            string name,
            ILocalizableString displayName,
            string icon = null,
            string url  = null,
            bool requiresAuthentication   = false,
            string requiredPermissionName = null,
            int order         = 0,
            object customData = null,
            IFeatureDependency featureDependency = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (displayName == null)
            {
                throw new ArgumentNullException("displayName");
            }

            Name                   = name;
            DisplayName            = displayName;
            Icon                   = icon;
            Url                    = url;
            RequiresAuthentication = requiresAuthentication;
            RequiredPermissionName = requiredPermissionName;
            Order                  = order;
            CustomData             = customData;
            FeatureDependency      = featureDependency;

            Items = new List <MenuItemDefinition>();
        }
Beispiel #12
0
 public ReactionDefinition(
     [NotNull] string name,
     [CanBeNull] ILocalizableString displayName = null)
 {
     Name        = Check.NotNullOrWhiteSpace(name, nameof(name));
     DisplayName = displayName;
 }
        /// <summary>
        /// Creates a new <see cref="MenuItemDefinition"/> object.
        /// </summary>
        public MenuItemDefinition(
            string name,
            ILocalizableString displayName,
            string icon = null,
            string url = null,
            bool requiresAuthentication = false,
            string requiredPermissionName = null,
            int order = 0,
            object customData = null,
            IFeatureDependency featureDependency = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name");
            }

            if (displayName == null)
            {
                throw new ArgumentNullException("displayName");
            }

            Name = name;
            DisplayName = displayName;
            Icon = icon;
            Url = url;
            RequiresAuthentication = requiresAuthentication;
            RequiredPermissionName = requiredPermissionName;
            Order = order;
            CustomData = customData;
            FeatureDependency = featureDependency;

            Items = new List<MenuItemDefinition>();
        }
        /// <summary>
        /// Creates a new <see cref="MenuItemDefinition"/> object.
        /// </summary>
        public MenuItemDefinition(
            string name,
            ILocalizableString displayName,
            string icon = null,
            string url  = null,
            bool requiresAuthentication   = false,
            string requiredPermissionName = null,
            int order         = 0,
            object customData = null,
            IFeatureDependency featureDependency = null,
            string target = null)
        {
            Check.NotNull(name, nameof(name));
            Check.NotNull(displayName, nameof(displayName));

            this.Name                   = name;
            this.DisplayName            = displayName;
            this.Icon                   = icon;
            this.Url                    = url;
            this.RequiresAuthentication = requiresAuthentication;
            this.RequiredPermissionName = requiredPermissionName;
            this.Order                  = order;
            this.CustomData             = customData;
            this.FeatureDependency      = featureDependency;
            this.Target                 = target;

            this.Items = new List <MenuItemDefinition>();
        }
        /// <summary>
        /// Creates a new <see cref="SettingDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting</param>
        /// <param name="defaultValue">Default value of the setting</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="group">Group of this setting</param>
        /// <param name="description">A brief description for this setting</param>
        /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
        /// <param name="isVisibleToClients">Can clients see this setting and it's value. Default: false</param>
        /// <param name="isInherited">Is this setting inherited from parent scopes. Default: True.</param>
        /// <param name="customData">Can be used to store a custom object related to this setting</param>
        public SettingDefinition(
            string name,
            string defaultValue,
            ILocalizableString displayName = null,
            SettingDefinitionGroup group   = null,
            ILocalizableString description = null,
            SettingScopes scopes           = SettingScopes.Application,
            bool isVisibleToClients        = false,
            bool isInherited  = true,
            object customData = null)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException(nameof(name));
            }

            Name               = name;
            DefaultValue       = defaultValue;
            DisplayName        = displayName;
            Group              = @group;
            Description        = description;
            Scopes             = scopes;
            IsVisibleToClients = isVisibleToClients;
            IsInherited        = isInherited;
            CustomData         = customData;
        }
        /// <summary>
        /// Creates a new <see cref="SettingDefinitionGroup"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting group</param>
        /// <param name="displayName">Display name of the setting</param>
        public SettingDefinitionGroup(string name, ILocalizableString displayName)
        {
            Guard.ArgumentNotNull(name, nameof(name));

            Name        = name;
            DisplayName = displayName;
            _children   = new List <SettingDefinitionGroup>();
        }
        /// <summary>
        /// Creates a new <see cref="SettingDefinitionGroup"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting group</param>
        /// <param name="displayName">Display name of the setting</param>
        public SettingDefinitionGroup(string name, ILocalizableString displayName)
        {
            Check.NotNullOrWhiteSpace(name, nameof(name));

            Name        = name;
            DisplayName = displayName;
            _children   = new List <SettingDefinitionGroup>();
        }
Beispiel #18
0
 public string L(ILocalizableString localizableString)
 {
     if (featureDescriptor == null)
     {
         return(null);
     }
     return(localizableString.Localize(WorkContext.Resolve <ILocalizationContext>()));
 }
Beispiel #19
0
        public WidgetDefinition Add(
            [NotNull] Type viewComponentType,
            [CanBeNull] ILocalizableString displayName = null)
        {
            var widget = new WidgetDefinition(viewComponentType, displayName);

            Add(widget);
            return(widget);
        }
Beispiel #20
0
 public TagEntityTypeDefiniton(
     [NotNull] string entityType,
     [CanBeNull] ILocalizableString displayName = null,
     IEnumerable <string> createPolicies        = null,
     IEnumerable <string> updatePolicies        = null,
     IEnumerable <string> deletePolicies        = null) : base(entityType, createPolicies, updatePolicies, deletePolicies)
 {
     DisplayName = displayName;
 }
        /// <summary>
        /// Adds a child permission.
        /// A child permission can be granted only if parent is granted.
        /// </summary>
        /// <returns>Returns newly created child permission</returns>
        public Permission CreateChildPermission(string name, ILocalizableString displayName, bool isGrantedByDefault = false, ILocalizableString description = null)
        {
            var permission = new Permission(name, displayName, isGrantedByDefault, description)
            {
                Parent = this
            };

            _children.Add(permission);
            return(permission);
        }
 public void AddOrReplace(
     [NotNull] string entityType,
     [CanBeNull] ILocalizableString displayName = null,
     [CanBeNull] string createPolicy            = null,
     [CanBeNull] string updatePolicy            = null,
     [CanBeNull] string deletePolicy            = null
     )
 {
     this[entityType] = new TagEntityTypeDefiniton(entityType, displayName, createPolicy, updatePolicy, deletePolicy);
 }
 /// <summary>
 /// Creates a new <see cref="SettingDefinition"/> object.
 /// </summary>
 /// <param name="name">Unique name of the setting</param>
 /// <param name="defaultValue">Default value of the setting</param>
 /// <param name="displayName">Display name of the permission</param>
 /// <param name="group">Group of this setting</param>
 /// <param name="description">A brief description for this setting</param>
 /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
 /// <param name="isVisibleToClients">Can clients see this setting and it's value</param>
 public SettingDefinition(string name, string defaultValue, ILocalizableString displayName = null, SettingDefinitionGroup group = null, ILocalizableString description = null, SettingScopes scopes = SettingScopes.Application, bool isVisibleToClients = false)
 {
     Name               = name;
     DefaultValue       = defaultValue;
     DisplayName        = displayName;
     Group              = @group;
     Description        = description;
     Scopes             = scopes;
     IsVisibleToClients = isVisibleToClients;
 }
 /// <summary>
 /// Creates a new <see cref="SettingDefinition"/> object.
 /// </summary>
 /// <param name="name">Unique name of the setting</param>
 /// <param name="defaultValue">Default value of the setting</param>
 /// <param name="displayName">Display name of the permission</param>
 /// <param name="group">Group of this setting</param>
 /// <param name="description">A brief description for this setting</param>
 /// <param name="scopes">Scopes of this setting. Default value: <see cref="SettingScopes.Application"/>.</param>
 /// <param name="isVisibleToClients">Can clients see this setting and it's value</param>
 public SettingDefinition(string name, string defaultValue, ILocalizableString displayName = null, SettingDefinitionGroup group = null, ILocalizableString description = null, SettingScopes scopes = SettingScopes.Application, bool isVisibleToClients = false)
 {
     Name = name;
     DefaultValue = defaultValue;
     DisplayName = displayName;
     Group = @group;
     Description = description;
     Scopes = scopes;
     IsVisibleToClients = isVisibleToClients;
 }
Beispiel #25
0
 /// <summary>
 /// Creates a new <see cref="SettingDefinitionGroup"/> object.
 /// </summary>
 /// <param name="name">Unique name of the setting group</param>
 /// <param name="displayName">Display name of the setting</param>
 public SettingDefinitionGroup(string name, ILocalizableString displayName)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentException("name parameter is invalid! It can not be null or empty or whitespace", "name"); //TODO: Simpify throwing such exceptions
     }
     Name        = name;
     DisplayName = displayName;
     _children   = new List <SettingDefinitionGroup>();
 }
Beispiel #26
0
 public TagEntityTypeDefiniton(
     [NotNull] string entityType,
     [CanBeNull] ILocalizableString displayName = null,
     [CanBeNull] string createPolicy            = null,
     [CanBeNull] string updatePolicy            = null,
     [CanBeNull] string deletePolicy            = null) : base(createPolicy, updatePolicy, deletePolicy)
 {
     EntityType  = Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
     DisplayName = displayName;
 }
Beispiel #27
0
        /// <summary>
        /// Adds a child permission.
        /// A child permission can be granted only if parent is granted.
        /// </summary>
        /// <returns>Returns newly created child permission</returns>
        public Permission CreateChildPermission(string name, ILocalizableString displayName, bool isGrantedByDefault = false, ILocalizableString description = null, MultiTenancySides multiTenancySides = MultiTenancySides.Host | MultiTenancySides.Tenant)
        {
            var permission = new Permission(name, displayName, isGrantedByDefault, description, multiTenancySides)
            {
                Parent = this
            };

            _children.Add(permission);
            return(permission);
        }
Beispiel #28
0
        /// <summary>
        /// Adds a child feature.
        /// 添加一个子功能
        /// </summary>
        /// <returns>Returns newly created child feature / 返回新创建的子功能</returns>
        public Feature CreateChildFeature(string name, string defaultValue, ILocalizableString displayName = null, ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All, IInputType inputType = null)
        {
            var feature = new Feature(name, defaultValue, displayName, description, scope, inputType)
            {
                Parent = this
            };

            _children.Add(feature);
            return(feature);
        }
        /// <summary>
        /// Creates a new child permission group under this group.
        /// </summary>
        /// <param name="name">Unique name of the group</param>
        /// <param name="displayName">Display name of the group</param>
        /// <returns>Newly created child permission group object</returns>
        public PermissionGroup CreateChildGroup(string name, ILocalizableString displayName)
        {
            var childGroup = new PermissionGroup(name, displayName)
            {
                Parent = this
            };

            _children.Add(childGroup);
            return(childGroup);
        }
Beispiel #30
0
        public virtual void Report(ILocalizableString message, decimal progressValue)
        {
            var progressItem = new ProgressItem
            {
                Message       = message,
                ProgressValue = progressValue
            };

            OnReport(progressItem);
        }
Beispiel #31
0
        public static Permission CreatePermission(
            string name,
            ILocalizableString displayName = null,
            ILocalizableString description = null,
            TenancySides multiTenancySides = TenancySides.Host | TenancySides.Tenant
            )
        {
            var permission = new Permission(name, displayName, description, multiTenancySides);

            return(permission);
        }
        /// <summary>
        /// Creates a new feature.
        /// </summary>
        /// <param name="name">Unique name of the feature</param>
        /// <param name="defaultValue">Default value</param>
        /// <param name="displayName">Display name of the feature</param>
        /// <param name="description">A brief description for this feature</param>
        /// <param name="scope">Feature scope</param>
        /// <param name="inputType">Input type</param>
        public Feature Create(string name, string defaultValue, ILocalizableString displayName = null, ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All, IInputType inputType = null)
        {
            if (Features.ContainsKey(name))
            {
                throw new InfrastructureException("There is already a feature with name: " + name);
            }
            var feature = new Feature(name, defaultValue, displayName, description, scope, inputType);

            Features[feature.Name] = feature;
            return(feature);
        }
        /// <summary>
        /// Creates a new <see cref="SettingDefinitionGroup"/> object.
        /// </summary>
        /// <param name="name">Unique name of the setting group</param>
        /// <param name="displayName">Display name of the setting</param>
        public SettingDefinitionGroup(string name, ILocalizableString displayName)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentException("name parameter is invalid! It can not be null or empty or whitespace", "name"); //TODO: Simpify throwing such exceptions
            }

            Name = name;
            DisplayName = displayName;
            _children = new List<SettingDefinitionGroup>();
        }
    public FeatureGroupDefinition AddGroup(string name, ILocalizableString displayName = null)
    {
        Check.NotNull(name, nameof(name));

        if (Groups.ContainsKey(name))
        {
            throw new AbpException($"There is already an existing permission group with name: {name}");
        }

        return(Groups[name] = new FeatureGroupDefinition(name, displayName));
    }
        public Permission CreatePermission(string name, ILocalizableString displayName = null, bool isGrantedByDefault = false, ILocalizableString description = null, MultiTenancySides multiTenancySides = MultiTenancySides.Host | MultiTenancySides.Tenant)
        {
            if (Permissions.ContainsKey(name))
            {
                throw new AbpException("There is already a permission with name: " + name);
            }

            var permission = new Permission(name, displayName, isGrantedByDefault, description, multiTenancySides);
            Permissions[permission.Name] = permission;
            return permission;
        }
        /// <summary>
        /// Creates a new feature.
        /// </summary>
        /// <param name="name">Unique name of the feature</param>
        /// <param name="defaultValue">Default value</param>
        /// <param name="displayName">Display name of the feature</param>
        /// <param name="description">A brief description for this feature</param>
        /// <param name="scope">Feature scope</param>
        /// <param name="inputType">Input type</param>
        public Feature Create(string name, string defaultValue, ILocalizableString displayName = null,
            ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All, IInputType inputType = null)
        {
            if (Features.ContainsKey(name))
            {
                throw new OwException("There is already a feature with name: " + name);
            }

            var feature = new Feature(name, defaultValue, displayName, description, scope, inputType);
            Features[feature.Name] = feature;
            return feature;

        }
        public Feature Create(string name, ILocalizableString displayName = null, bool isDisabled = false,
            ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All)
        {
            if (Features.ContainsKey(name))
            {
                throw new AbpException("There is already a feature with name: " + name);
            }

            var feature = new Feature(name, displayName, isDisabled, description, scope);
            Features[feature.Name] = feature;
            return feature;

        }
Beispiel #38
0
        public Permission(string name, ILocalizableString displayName=null,bool isGrantedByDefault= false, ILocalizableString description=null,MultiTenancySides multiTenancySides=MultiTenancySides.Host|MultiTenancySides.Tenant)
        {
            if (name==null)
            {
                throw new ArgumentNullException("name");
            }

            Name = name;
            DisplayName = displayName;
            IsGrantedByDefault = isGrantedByDefault;
            Description = description;
            MultiTenancySides = multiTenancySides;
            _children = new List<Permission>();
        }
        public NotificationDefinition(string name, ILocalizableString displayName)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (displayName == null)
            {
                throw new ArgumentNullException("displayName");
            }

            Name = name;
            DisplayName = displayName;
        }
Beispiel #40
0
        /// <summary>
        /// Creates a new feature.
        /// </summary>
        /// <param name="name">Unique name of the feature</param>
        /// <param name="isDisabled">This property can be used to disable this feature completely.</param>
        /// <param name="displayName">Display name of the feature</param>
        /// <param name="description">A brief description for this feature</param>
        /// <param name="scope">Feature scope</param>
        public Feature(string name, ILocalizableString displayName = null, bool isDisabled = false, ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            Name = name;
            DisplayName = displayName;
            IsDisabled = isDisabled;
            Description = description;
            Scope = scope;

            _children = new List<Feature>();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="NotificationDefinition"/> class.
        /// </summary>
        /// <param name="name">Unique name of the notification.</param>
        /// <param name="entityType">Related entity type with this notification (optional).</param>
        /// <param name="displayName">Display name of the notification.</param>
        /// <param name="description">Description for the notification</param>
        /// <param name="permissionDependency">A permission dependency. This notification will be available to a user if this dependency is satisfied.</param>
        /// <param name="featureDependency">A feature dependency. This notification will be available to a tenant if this feature is enabled.</param>
        public NotificationDefinition(string name, Type entityType = null, ILocalizableString displayName = null, ILocalizableString description = null, IPermissionDependency permissionDependency = null, IFeatureDependency featureDependency = null)
        {
            if (string.IsNullOrWhiteSpace(name))
            {
                throw new ArgumentNullException("name", "name can not be null, empty or whitespace!");
            }
            
            Name = name;
            EntityType = entityType;
            DisplayName = displayName;
            Description = description;
            PermissionDependency = permissionDependency;
            FeatureDependency = featureDependency;

            Attributes = new Dictionary<string, object>();
        }
        public Permission CreatePermission(
            string name, 
            ILocalizableString displayName = null, 
            ILocalizableString description = null, 
            MultiTenancySides multiTenancySides = MultiTenancySides.Host | MultiTenancySides.Tenant,
            IFeatureDependency featureDependency = null)
        {
            if (Permissions.ContainsKey(name))
            {
                throw new AbpException("There is already a permission with name: " + name);
            }

            var permission = new Permission(name, displayName, description, multiTenancySides, featureDependency);
            Permissions[permission.Name] = permission;
            return permission;
        }
        /// <summary>
        /// Creates a new feature.
        /// </summary>
        /// <param name="name">Unique name of the feature</param>
        /// <param name="defaultValue">Default value</param>
        /// <param name="displayName">Display name of the feature</param>
        /// <param name="description">A brief description for this feature</param>
        /// <param name="scope">Feature scope</param>
        /// <param name="inputType">Input type</param>
        public Feature(string name, string defaultValue, ILocalizableString displayName = null, ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All, IInputType inputType = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            Name = name;
            DisplayName = displayName;
            Description = description;
            Scope = scope;
            DefaultValue = defaultValue;
            InputType = inputType ?? new CheckboxInputType();

            _children = new List<Feature>();
            Attributes = new Dictionary<string, object>();
        }
        /// <summary>
        /// Creates a new <see cref="PermissionGroup"/> object.
        /// </summary>
        internal PermissionGroup(string name, ILocalizableString displayName)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (displayName == null)
            {
                throw new ArgumentNullException("displayName");
            }

            Name = name;
            DisplayName = displayName;
            _children = new List<PermissionGroup>();
            _permissions = new List<Permission>();
        }
        /// <summary>
        /// Creates a new <see cref="MenuDefinition"/> object.
        /// </summary>
        /// <param name="name">Unique name of the menu</param>
        /// <param name="displayName">Display name of the menu</param>
        public MenuDefinition(string name, ILocalizableString displayName)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentNullException("name", "Menu name can not be empty or null.");
            }

            if (displayName == null)
            {
                throw new ArgumentNullException("displayName", "Display name of the menu can not be null.");
            }

            Name = name;
            DisplayName = displayName;

            Items = new List<MenuItemDefinition>();
        }
        /// <summary>
        /// 创建权限
        /// </summary>
        /// <param name="name">权限名称</param>
        /// <param name="displayName">权限显示名称</param>
        /// <param name="isGrantedByDefault"></param>
        /// <param name="description">权限描述</param>
        /// <param name="multiTenancySides">多租户</param>
        /// <param name="featureDependency">特征依赖</param>
        /// <returns></returns>
        public Permission CreatePermission(
            string name, 
            ILocalizableString displayName = null, 
            bool isGrantedByDefault = false, 
            ILocalizableString description = null, 
            MultiTenancySides multiTenancySides = MultiTenancySides.Host | MultiTenancySides.Tenant,
            IFeatureDependency featureDependency = null)
        {
            //权限字典中是否包含指定的键
            if (Permissions.ContainsKey(name))
            {
                //权限字典中已经包含这个权限,名称为:
                throw new AbpException("There is already a permission with name: " + name);
            }

            var permission = new Permission(name, displayName, isGrantedByDefault, description, multiTenancySides, featureDependency);
            Permissions[permission.Name] = permission;
            return permission;
        }
        /// <summary>
        /// Creates a new Permission.
        /// </summary>
        /// <param name="name">Unique name of the permission</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="isGrantedByDefault">Is this permission granted by default. Default value: false.</param>
        /// <param name="description">A brief description for this permission</param>
        internal Permission(string name, ILocalizableString displayName, bool isGrantedByDefault = false, ILocalizableString description = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            if (displayName == null)
            {
                throw new ArgumentNullException("displayName");
            }

            Name = name;
            DisplayName = displayName;
            IsGrantedByDefault = isGrantedByDefault;
            Description = description;

            _children = new List<Permission>();
        }
        /// <summary>
        /// Creates a new Permission.
        /// </summary>
        /// <param name="name">Unique name of the permission</param>
        /// <param name="displayName">Display name of the permission</param>
        /// <param name="description">A brief description for this permission</param>
        /// <param name="multiTenancySides">Which side can use this permission</param>
        /// <param name="featureDependency">Depended feature(s) of this permission</param>
        public Permission(
            string name,
            ILocalizableString displayName = null,
            ILocalizableString description = null,
            MultiTenancySides multiTenancySides = MultiTenancySides.Host | MultiTenancySides.Tenant,
            IFeatureDependency featureDependency = null)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }

            Name = name;
            DisplayName = displayName;
            Description = description;
            MultiTenancySides = multiTenancySides;
            FeatureDependency = featureDependency;

            _children = new List<Permission>();
        }
            public PermissionGroup CreateRootGroup(string name, ILocalizableString displayName)
            {
                if (_rootGroups.ContainsKey(name))
                {
                    throw new AbpInitializationException(
                        string.Format(
                            "There is already a root permission group named '{0}'. Try to get it using GetRootGroupOrNull method",
                            name));
                }

                return _rootGroups[name] = new PermissionGroup(name, displayName);
            }
 /// <summary>
 /// Creates a new permission under this group.
 /// </summary>
 /// <param name="name">Unique name of the permission</param>
 /// <param name="displayName">Display name of the permission</param>
 /// <param name="isGrantedByDefault">Is this permission granted by default. Default value: false.</param>
 /// <param name="description">A brief description for this permission</param>
 /// <returns>New created permission</returns>
 public Permission CreatePermission(string name, ILocalizableString displayName, bool isGrantedByDefault = false, ILocalizableString description = null)
 {
     var permission = new Permission(name, displayName, isGrantedByDefault, description);
     _permissions.Add(permission);
     return permission;
 }
Beispiel #51
0
 /// <summary>
 /// Adds a child feature.
 /// </summary>
 /// <returns>Returns newly created child feature</returns>
 public Feature CreateChildFeature(string name, string defaultValue, ILocalizableString displayName = null, ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All, IInputType inputType = null)
 {
     var feature = new Feature(name, defaultValue, displayName, description, scope, inputType) { Parent = this };
     _children.Add(feature);
     return feature;
 }
 public LocalizableComboboxItem(string value, ILocalizableString displayText)
 {
     Value = value;
     DisplayText = displayText;
 }
 /// <summary>
 /// Creates a new child permission group under this group.
 /// </summary>
 /// <param name="name">Unique name of the group</param>
 /// <param name="displayName">Display name of the group</param>
 /// <returns>Newly created child permission group object</returns>
 public PermissionGroup CreateChildGroup(string name, ILocalizableString displayName)
 {
     var childGroup = new PermissionGroup(name, displayName) { Parent = this };
     _children.Add(childGroup);
     return childGroup;
 }
 /// <summary>
 /// Adds a child permission.
 /// A child permission can be granted only if parent is granted.
 /// </summary>
 /// <returns>Returns newly created child permission</returns>
 public Permission CreateChildPermission(string name, ILocalizableString displayName, bool isGrantedByDefault = false, ILocalizableString description = null)
 {
     var permission = new Permission(name, displayName, isGrantedByDefault, description) { Parent = this };
     _children.Add(permission);
     return permission;
 }
Beispiel #55
0
 /// <summary>
 /// Adds a child feature.
 /// A child feature can be enabled only if parent is enabled.
 /// </summary>
 /// <returns>Returns newly created child feature</returns>
 public Feature CreateChildFeature(string name, ILocalizableString displayName = null, bool isDisabled = false, ILocalizableString description = null, FeatureScopes scope = FeatureScopes.All)
 {
     var feature = new Feature(name, displayName, isDisabled, description, scope) { Parent = this };
     _children.Add(feature);
     return feature;
 }
Beispiel #56
0
 /// <summary>
 /// Adds a child permission.
 /// A child permission can be granted only if parent is granted.
 /// </summary>
 /// <returns>Returns newly created child permission</returns>
 public Permission CreateChildPermission(
     string name, 
     ILocalizableString displayName = null, 
     bool isGrantedByDefault = false, 
     ILocalizableString description = null, 
     MultiTenancySides multiTenancySides = MultiTenancySides.Host | MultiTenancySides.Tenant,
     IFeatureDependency featureDependency = null)
 {
     var permission = new Permission(name, displayName, isGrantedByDefault, description, multiTenancySides, featureDependency) { Parent = this };
     _children.Add(permission);
     return permission;
 }