public PropertyRulePack GetPropertyRule(string typeName, string roleId)
        {
            BasicPermission.AdminRules.AssertAuthorized();
            var rules = PropertyAuthLogic.GetPropertyRules(Lite.ParsePrimaryKey <RoleEntity>(roleId).FillToString(), TypeLogic.GetType(typeName).ToTypeEntity());

            CleanChanges(rules);
            return(rules);
        }
Esempio n. 2
0
        static string Mapping_CanChange(PropertyRoute route)
        {
            switch (PropertyAuthLogic.GetPropertyAllowed(route))
            {
            case PropertyAllowed.Modify: return(null);

            case PropertyAllowed.None:
            case PropertyAllowed.Read:
            default: return(AuthMessage.NotAuthorizedToChangeProperty0on1.NiceToString().FormatWith(route.PropertyString(), route.RootType.NiceName()));
            }
        }
Esempio n. 3
0
    public static void StartAllModules(SchemaBuilder sb, bool activeDirectoryIntegration = false)
    {
        TypeAuthLogic.Start(sb);
        PropertyAuthLogic.Start(sb);
        QueryAuthLogic.Start(sb);
        OperationAuthLogic.Start(sb);
        PermissionAuthLogic.Start(sb);

        if (activeDirectoryIntegration)
        {
            PermissionAuthLogic.RegisterTypes(typeof(ActiveDirectoryPermission));
        }
    }
Esempio n. 4
0
        public ActionResult SaveProperties(FormCollection form, string prefix)
        {
            Lite <RoleEntity> role = this.ExtractLite <RoleEntity>(TypeContextUtilities.Compose(prefix, "Role"));
            TypeEntity        type = this.ExtractEntity <TypeEntity>(TypeContextUtilities.Compose(prefix, "Type"));

            var prp = PropertyAuthLogic.GetPropertyRules(role, type).ApplyChanges(this, prefix);

            PropertyAuthLogic.SetPropertyRules(prp.Value);

            if (prp.HasErrors())
            {
                return(prp.ToJsonModelState());
            }

            return(null);
        }
Esempio n. 5
0
        static void TaskAuthorizeProperties(LineBase bl)
        {
            if (bl.PropertyRoute.PropertyRouteType == PropertyRouteType.FieldOrProperty)
            {
                switch (PropertyAuthLogic.GetPropertyAllowed(bl.PropertyRoute))
                {
                case PropertyAllowed.None:
                    bl.Visible = false;
                    break;

                case PropertyAllowed.Read:
                    bl.ReadOnly = true;
                    break;

                case PropertyAllowed.Modify:
                    break;
                }
            }
        }
Esempio n. 6
0
 public ActionResult Properties(Lite <RoleEntity> role, Lite <TypeEntity> type)
 {
     return(this.PopupNavigate(PropertyAuthLogic.GetPropertyRules(role.FillToString(), type.Retrieve())));
 }
Esempio n. 7
0
        public static void Start(SchemaBuilder sb)
        {
            if (sb.NotDefined(MethodInfo.GetCurrentMethod()))
            {
                sb.Include <ProcessAlgorithmSymbol>()
                .WithQuery(() => pa => new
                {
                    Entity = pa,
                    pa.Id,
                    pa.Key
                });

                sb.Include <ProcessEntity>()
                .WithQuery(() => p => new
                {
                    Entity = p,
                    p.Id,
                    p.Algorithm,
                    p.Data,
                    p.State,
                    p.MachineName,
                    p.ApplicationName,
                    p.CreationDate,
                    p.PlannedDate,
                    p.CancelationDate,
                    p.QueuedDate,
                    p.ExecutionStart,
                    p.ExecutionEnd,
                    p.SuspendDate,
                    p.ExceptionDate,
                });

                sb.Include <ProcessExceptionLineEntity>()
                .WithQuery(() => p => new
                {
                    Entity = p,
                    p.Process,
                    p.Line,
                    p.ElementInfo,
                    p.Exception,
                });

                PermissionAuthLogic.RegisterPermissions(ProcessPermission.ViewProcessPanel);

                SymbolLogic <ProcessAlgorithmSymbol> .Start(sb, () => registeredProcesses.Keys.ToHashSet());

                OperationLogic.AssertStarted(sb);

                ProcessGraph.Register();

                QueryLogic.Expressions.Register((ProcessAlgorithmSymbol p) => p.Processes(), () => typeof(ProcessEntity).NicePluralName());
                QueryLogic.Expressions.Register((ProcessAlgorithmSymbol p) => p.LastProcess(), () => ProcessMessage.LastProcess.NiceToString());

                QueryLogic.Expressions.Register((IProcessDataEntity p) => p.Processes(), () => typeof(ProcessEntity).NicePluralName());
                QueryLogic.Expressions.Register((IProcessDataEntity p) => p.LastProcess(), () => ProcessMessage.LastProcess.NiceToString());

                QueryLogic.Expressions.Register((ProcessEntity p) => p.ExceptionLines(), () => ProcessMessage.ExceptionLines.NiceToString());
                QueryLogic.Expressions.Register((IProcessLineDataEntity p) => p.ExceptionLines(), () => ProcessMessage.ExceptionLines.NiceToString());

                PropertyAuthLogic.SetMaxAutomaticUpgrade(PropertyRoute.Construct((ProcessEntity p) => p.User), PropertyAllowed.Read);

                ExceptionLogic.DeleteLogs += ExceptionLogic_DeleteLogs;
            }
        }
 public void SetPropertyRule([Required, FromBody] PropertyRulePack rules)
 {
     BasicPermission.AdminRules.AssertAuthorized();
     PropertyAuthLogic.SetPropertyRules(rules);
     Schema.Current.InvalidateMetadata();
 }
Esempio n. 9
0
 public void SetPropertyRule(PropertyRulePack rules)
 {
     BasicPermission.AdminRules.AssertAuthorized();
     PropertyAuthLogic.SetPropertyRules(rules);
 }