Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Factor out Policy Names #836

Merged
merged 1 commit into from
Oct 20, 2020
Merged

Factor out Policy Names #836

merged 1 commit into from
Oct 20, 2020

Conversation

TonyValenti
Copy link

Factor out Policy Names
Change AppDomain to AppContext (AppDomain just passes it through to AppContext and AppDomain is basically considered legacy).

Change AppDomain to AppContext
public class PolicyNames {
namespace Oqtane.Shared
{
public class PolicyNames
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If @sbwalker agree with this change I'd like to use static readonly field instead of const

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can't use static readonly in attributes though. Ie.:

        [HttpGet("{id}")]
        [Authorize(Policy = PolicyNames.ViewModule)]
        public List<HtmlTextInfo> Get(int id)
        {
            var list = new List<HtmlTextInfo>();
            try
            {
                HtmlTextInfo htmlText = null;
                if (_entityId == id)
                {
                    htmlText = _htmlText.GetHtmlText(id);
                    list.Add(htmlText);
                }
            }
            catch (Exception ex)
            {
                _logger.Log(LogLevel.Error, this, LogFunction.Read, ex, "Get Error {Error}", ex.Message);
                throw;
            }
            return list;
        }

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right I didn't notice they are using there

@sbwalker sbwalker merged commit ef51d5f into oqtane:master Oct 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants