mirror of https://github.com/Ombi-app/Ombi
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
74 lines
2.1 KiB
74 lines
2.1 KiB
8 years ago
|
using Ombi.Core.SettingModels;
|
||
|
using Ombi.Helpers.Permissions;
|
||
8 years ago
|
|
||
8 years ago
|
namespace Ombi.Core.Users
|
||
8 years ago
|
{
|
||
|
public static class UserManagementHelper
|
||
|
{
|
||
|
|
||
|
public static int GetPermissions(UserManagementSettings settings)
|
||
|
{
|
||
|
var permission = 0;
|
||
|
|
||
|
if (settings.AutoApproveMovies)
|
||
|
{
|
||
|
permission += (int)Permissions.AutoApproveMovie;
|
||
|
}
|
||
|
if (settings.AutoApproveMusic)
|
||
|
{
|
||
|
permission += (int)Permissions.AutoApproveAlbum;
|
||
|
}
|
||
|
if (settings.AutoApproveTvShows)
|
||
|
{
|
||
|
permission += (int)Permissions.AutoApproveTv;
|
||
|
}
|
||
|
if (settings.RequestMovies)
|
||
|
{
|
||
|
permission += (int)Permissions.RequestMovie;
|
||
|
}
|
||
|
if (settings.RequestMusic)
|
||
|
{
|
||
|
permission += (int)Permissions.RequestMusic;
|
||
|
}
|
||
|
if (settings.RequestTvShows)
|
||
|
{
|
||
|
permission += (int)Permissions.RequestTvShow;
|
||
|
}
|
||
|
if (settings.ReportIssues)
|
||
|
{
|
||
|
permission += (int)Permissions.ReportIssue;
|
||
|
}
|
||
8 years ago
|
if (settings.UsersCanViewOnlyOwnRequests)
|
||
|
{
|
||
|
permission += (int)Permissions.UsersCanViewOnlyOwnRequests;
|
||
|
}
|
||
|
if (settings.UsersCanViewOnlyOwnIssues)
|
||
|
{
|
||
|
permission += (int)Permissions.UsersCanViewOnlyOwnIssues;
|
||
|
}
|
||
8 years ago
|
if (settings.BypassRequestLimit)
|
||
|
{
|
||
|
permission += (int) Permissions.BypassRequestLimit;
|
||
|
}
|
||
8 years ago
|
|
||
|
|
||
|
return permission;
|
||
|
}
|
||
|
|
||
|
public static int GetFeatures(UserManagementSettings settings)
|
||
|
{
|
||
|
var features = 0;
|
||
|
|
||
|
if (settings.RecentlyAddedNewsletter)
|
||
|
{
|
||
|
features += (int)Features.Newsletter;
|
||
|
}
|
||
|
if (settings.RecentlyAddedNotification)
|
||
|
{
|
||
8 years ago
|
features += (int)Features.RequestAddedNotification;
|
||
8 years ago
|
}
|
||
|
|
||
|
return features;
|
||
|
}
|
||
|
}
|
||
|
}
|