示例#1
0
        public IPermissionConfiguration AllowTo(string action, string subject)
        {
            var permission = new StringBasedPermission(action, subject, actionCleaner, subjectCleaner);

            permissions.Add(permission);
            logger.LogConfiguration(string.Format("user has the ability to {0}/{1}", action, subject));
            return(permission);
        }
示例#2
0
        public async Task RunAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Raspberry Pi Sensor Node started.");
            _configurationLogger.LogConfiguration();

            await _cpuTemperatureMonitor.RunAsync(cancellationToken);
        }
        public async Task Run(CancellationToken cancellationToken)
        {
            _logger.LogInformation("Raspberry Pi Sensor Node started.");
            //_logger.LogInformation($"Running on .NET Core {Environment.Version}"); // Commented out for now - .NET Core 3 finally fixes this, returns 4.xx on .NET Core 2.2.
            _configurationLogger.LogConfiguration();

            await _cpuTemperatureMonitor.Run(cancellationToken);
        }
示例#4
0
 public void AddSubjectAliases(string intendedSubject, string[] aliases)
 {
     foreach (var alias in aliases.Select(a => a.ToLower()))
     {
         intendedSubject = intendedSubject.ToLower();
         if (subjectAliases.ContainsKey(alias))
         {
             logger.LogConfiguration(string.Format("overwriting subject alias '{0} = {1}' (was '{0} = {2}')", alias, intendedSubject, subjectAliases[alias]));
             subjectAliases[alias] = intendedSubject;
         }
         else
         {
             logger.LogConfiguration(string.Format("creating subject alias '{0} = {1}'", alias, intendedSubject));
             subjectAliases.Add(alias, intendedSubject);
         }
     }
 }
示例#5
0
        public void ConfigureAliases(string intendedAction, params string[] aliases)
        {
            intendedAction = intendedAction.ToLower();

            foreach (var alias in aliases.Select(a => a.ToLower()))
            {
                if (actionAliases.ContainsKey(alias))
                {
                    if (actionAliases[alias] == intendedAction)
                    {
                        continue;
                    }

                    logger.LogConfiguration(string.Format("overwriting action alias '{0} = {1}' (was '{0} = {2}')", alias, intendedAction, actionAliases[alias]));
                    actionAliases[alias] = intendedAction;
                }
                else
                {
                    logger.LogConfiguration(string.Format("creating action alias '{0} = {1}'", alias, intendedAction));
                    actionAliases.Add(alias, intendedAction);
                }
            }
        }