예제 #1
0
 public static void Evaluate(State.Linked.LinkedStaffMember account)
 {
     if (account.Wisa.Exists && !account.Directory.Exists && account.Smartschool.Exists)
     {
         account.Actions.Add(new AddToDirectory());
     }
 }
예제 #2
0
 public static void Evaluate(State.Linked.LinkedStaffMember account)
 {
     if (!account.Wisa.Exists && account.Directory.Exists)
     {
         account.Actions.Add(new RemoveFromDirectory());
     }
 }
        public async override Task Apply(State.Linked.LinkedStaffMember linkedAccount)
        {
            linkedAccount.Smartschool.Account.Mail = linkedAccount.Directory.Account.PrincipalName;
            await AccountApi.Smartschool.AccountManager.Save(linkedAccount.Smartschool.Account, "").ConfigureAwait(false);

            MainWindow.Instance.Log.AddMessage(AccountApi.Origin.Smartschool, "Email aangepast voor " + linkedAccount.Directory.Account.FullName);
        }
 public static void Evaluate(State.Linked.LinkedStaffMember account)
 {
     if (account.Wisa.Exists && !account.Smartschool.Exists && !account.Directory.Exists)// && !account.Google.Exists)
     {
         account.Actions.Add(new DontImportFromWisa());
     }
 }
예제 #5
0
        public async override Task Apply(State.Linked.LinkedStaffMember linkedAccount)
        {
            bool connected = await State.App.Instance.AD.Connect().ConfigureAwait(false);

            if (!connected)
            {
                return;
            }

            var wisa        = linkedAccount.Wisa.Account;
            var smartschool = linkedAccount.Smartschool.Account;

            var usernameExists = await AccountApi.Directory.AccountManager.Exists(smartschool.UID).ConfigureAwait(false);

            var directory = await AccountApi.Directory.AccountManager.Create(
                wisa.FirstName,
                wisa.LastName,
                wisa.CODE,
                AccountRole.Teacher,
                "",
                usernameExists? "" : smartschool.UID
                ).ConfigureAwait(false);

            if (directory != null)
            {
                MainWindow.Instance.Log.AddMessage(Origin.Directory, "Added account for " + wisa.FirstName + " " + wisa.LastName);
            }
            else
            {
                MainWindow.Instance.Log.AddError(Origin.Directory, "Failed to add " + wisa.FirstName + " " + wisa.LastName);
            }
        }
        public static void AddActions(State.Linked.LinkedStaffMember account)
        {
            if (account is null)
            {
                return;
            }

            account.OK = true;
            account.SetBasicFlags();

            if (!account.Wisa.Exists || !account.Directory.Exists || !account.Smartschool.Exists)
            {
                AddToDirectory.Evaluate(account);
                RemoveFromDirectory.Evaluate(account);
                RemoveFromSmartschool.Evaluate(account);
                DontImportFromAD.Evaluate(account);
                DontImportFromWisa.Evaluate(account);
                account.OK = false;
            }

            if (account.OK)
            {
                UpdateWisaName.Evaluate(account);
                AddToADStaffGroup.Evaluate(account);
                PrincipalNameMustEqualMail.Evaluate(account);
                ModifySmartschoolStaffEmail.Evaluate(account);
            }
        }
        public static void Evaluate(State.Linked.LinkedStaffMember account)
        {
            if (account.Directory.Account.Role == AccountApi.AccountRole.Teacher &&
                !account.Directory.Account.Groups.Contains("CN=" + State.App.Instance.Settings.SchoolPrefix.Value + "-Leraren,OU=ArcadiaGroups,DC=arcadiascholen,DC=be"))
            {
                account.Directory.FlagWarning();
                account.Actions.Add(new AddToADStaffGroup());
                account.OK = false;
            }

            if (account.Directory.Account.Role == AccountApi.AccountRole.Support &&
                !account.Directory.Account.Groups.Contains("CN=" + State.App.Instance.Settings.SchoolPrefix.Value + "-Secretariaat,OU=ArcadiaGroups,DC=arcadiascholen,DC=be"))
            {
                account.Directory.FlagWarning();
                account.Actions.Add(new AddToADStaffGroup());
                account.OK = false;
            }

            //if (!account.Directory.Account.Groups.Contains("CN=" + State.App.Instance.Settings.SchoolPrefix.Value + "-Secretariaat,OU=ArcadiaGroups,DC=arcadiascholen,DC=be"))
            //{
            //    account.Directory.FlagWarning();
            //    account.Actions.Add(new AddToADStaffGroup());
            //    account.OK = false;
            //}
        }
예제 #8
0
        public async override Task Apply(State.Linked.LinkedStaffMember account)
        {
            bool connected = await State.App.Instance.AD.Connect().ConfigureAwait(false);

            if (!connected)
            {
                return;
            }

            await AccountApi.Directory.AccountManager.DeleteStaff(account.Directory.Account).ConfigureAwait(false);
        }
        public override FlowDocument GetDetails(State.Linked.LinkedStaffMember account)
        {
            var result = new FlowTableCreator(true);

            result.SetHeaders(new string[] { "Active Directory", "Smartschool" });

            result.AddRow(new List <string>()
            {
                "Email", account.Directory.Account.PrincipalName, account.Smartschool.Account.Mail
            });

            FlowDocument document = new FlowDocument();

            document.Blocks.Add(result.Create());

            return(document);
        }
        public static void Evaluate(State.Linked.LinkedStaffMember account)
        {
            string[] mailParts = account.Smartschool.Account.Mail.Split('@');
            if (mailParts.Length > 1)
            {
                string domain = mailParts[1];
                if (!domain.Equals("arcadiascholen.be", StringComparison.CurrentCulture))
                {
                    return;
                }
            }

            if (!account.Directory.Account.PrincipalName.Equals(account.Smartschool.Account.Mail, StringComparison.CurrentCulture))
            {
                account.Smartschool.FlagWarning();
                account.Actions.Add(new ModifySmartschoolStaffEmail());
                account.OK = false;
            }
        }
        public async override Task Apply(State.Linked.LinkedStaffMember account)
        {
            bool connected = await State.App.Instance.AD.Connect().ConfigureAwait(false);

            if (!connected)
            {
                return;
            }

            // TODO: should not be bound to school
            if (account.Directory.Account.Role == AccountApi.AccountRole.Teacher)
            {
                await account.Directory.Account.AddToGroup("CN=" + State.App.Instance.Settings.SchoolPrefix.Value + "-Leraren,OU=ArcadiaGroups,DC=arcadiascholen,DC=be").ConfigureAwait(false);
            }
            if (account.Directory.Account.Role == AccountApi.AccountRole.Support)
            {
                await account.Directory.Account.AddToGroup("CN=" + State.App.Instance.Settings.SchoolPrefix.Value + "-Secretariaat,OU=ArcadiaGroups,DC=arcadiascholen,DC=be").ConfigureAwait(false);
            }
        }
 public async override Task Apply(State.Linked.LinkedStaffMember account)
 {
     await AccountApi.Smartschool.AccountManager.Delete(account.Smartschool.Account).ConfigureAwait(false);
 }
 public override Task Apply(State.Linked.LinkedStaffMember linkedAccount)
 {
     throw new NotImplementedException();
 }
        public async override Task Apply(State.Linked.LinkedStaffMember account)
        {
            IRule rule = State.App.Instance.Wisa.AddimportRule(AccountApi.Rule.WI_DontImportUser);

            rule.SetConfig(0, account.Wisa.Account.CODE);
        }
        public async override Task Apply(State.Linked.LinkedStaffMember account)
        {
            IRule rule = State.App.Instance.AD.AddimportRule(AccountApi.Rule.AD_DontImportUser);

            rule.SetConfig(0, account.Directory.Account.UID);
        }