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 OwException("There is already a permission with name: " + name);
            }

            var permission = new Permission(name, displayName, isGrantedByDefault, description, multiTenancySides, featureDependency);
            Permissions[permission.Name] = permission;
            return permission;
        }
Exemplo n.º 2
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;
 }