Пример #1
0
		void SaveProperties()
		{
			Role = new UserRole();
			Role.UID = UID;
			Role.Name = Name;
			Role.PermissionStrings = new List<string>(
				Permissions.Where(x => x.IsEnable).Select(x => x.Name)
			);
		}
Пример #2
0
		public RoleDetailsViewModel(UserRole role = null)
		{
			if (role != null)
			{
				Title = string.Format("Свойства роли: {0}", role.Name);
				Role = role;
			}
			else
			{
				Title = "Создание новой роли";
				Role = new UserRole();
			}

			CopyProperties();
		}
Пример #3
0
        void CopyProperties()
        {
            Login = User.Login;
            Name = User.Name;

            Roles = new ObservableCollection<UserRole>();
            foreach (var role in FiresecManager.SecurityConfiguration.UserRoles)
                Roles.Add(role);

            if (IsNew)
            {
                UserRole = Roles.FirstOrDefault();
            }
            else
            {
                UserRole = Roles.FirstOrDefault(role => role.Id == User.RoleId);
            }

            RemoteAccess = (IsNew || User.RemoreAccess == null) ?
                new RemoteAccessViewModel(new RemoteAccess() { RemoteAccessType = RemoteAccessType.RemoteAccessBanned }) :
                new RemoteAccessViewModel(User.RemoreAccess);
        }