last ...
This commit is contained in:
@@ -0,0 +1,616 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fa" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
|
<title>گزارش نشست — XRolesController و سرویسهای تست (xIds)</title>
|
||||||
|
<style>
|
||||||
|
:root{
|
||||||
|
--bg:#0f172a; --panel:#111c33; --panel-2:#0b1424;
|
||||||
|
--text:#e6edf7; --muted:#9db0cc; --border:#20304d;
|
||||||
|
--accent:#4f8cff; --accent-2:#22c55e; --warn:#f59e0b; --danger:#ef4444;
|
||||||
|
--code-bg:#0a1020; --code-border:#1c2a44;
|
||||||
|
--font: "Vazirmatn","Segoe UI",Tahoma,sans-serif;
|
||||||
|
}
|
||||||
|
*{box-sizing:border-box}
|
||||||
|
body{
|
||||||
|
margin:0; background:linear-gradient(180deg,#08111f 0%,#0f172a 100%);
|
||||||
|
color:var(--text); font-family:var(--font); line-height:1.85; font-size:15px;
|
||||||
|
}
|
||||||
|
.wrap{max-width:1100px;margin:0 auto;padding:28px 22px 80px}
|
||||||
|
header.hero{
|
||||||
|
background:radial-gradient(1200px 400px at 20% -10%, rgba(79,140,255,.25), transparent 60%),
|
||||||
|
radial-gradient(900px 300px at 90% 10%, rgba(34,197,94,.18), transparent 60%),
|
||||||
|
var(--panel);
|
||||||
|
border:1px solid var(--border); border-radius:18px; padding:28px 26px;
|
||||||
|
box-shadow:0 10px 30px rgba(0,0,0,.35);
|
||||||
|
}
|
||||||
|
.badge{display:inline-block;background:rgba(79,140,255,.15);color:var(--accent);
|
||||||
|
border:1px solid rgba(79,140,255,.4);padding:4px 10px;border-radius:999px;
|
||||||
|
font-size:12px;margin-left:6px}
|
||||||
|
.badge.warn{background:rgba(245,158,11,.12);color:var(--warn);border-color:rgba(245,158,11,.4)}
|
||||||
|
.badge.ok{background:rgba(34,197,94,.12);color:var(--accent-2);border-color:rgba(34,197,94,.4)}
|
||||||
|
h1{margin:6px 0 6px;font-size:26px;letter-spacing:.2px}
|
||||||
|
h2{margin:34px 0 12px;font-size:20px;padding-bottom:8px;border-bottom:1px dashed var(--border)}
|
||||||
|
h3{margin:22px 0 8px;font-size:16px;color:#cfe0ff}
|
||||||
|
p.lead{color:var(--muted);margin:6px 0 0}
|
||||||
|
.meta{margin-top:14px;display:flex;flex-wrap:wrap;gap:10px;color:var(--muted);font-size:13px}
|
||||||
|
.card{background:var(--panel);border:1px solid var(--border);border-radius:14px;padding:18px 18px;margin:14px 0}
|
||||||
|
.card.note{border-left:4px solid var(--warn)}
|
||||||
|
.card.ok{border-left:4px solid var(--accent-2)}
|
||||||
|
.card.info{border-left:4px solid var(--accent)}
|
||||||
|
code, pre{font-family:Consolas,"Cascadia Code",Menlo,monospace;direction:ltr;text-align:left}
|
||||||
|
pre{
|
||||||
|
background:var(--code-bg);border:1px solid var(--code-border);border-radius:12px;
|
||||||
|
padding:16px 16px;overflow:auto;font-size:13px;line-height:1.6;margin:10px 0 0;
|
||||||
|
}
|
||||||
|
pre .k{color:#7dd3fc} pre .s{color:#86efac} pre .c{color:#64748b;font-style:italic}
|
||||||
|
pre .n{color:#fbbf24} pre .t{color:#f0abfc}
|
||||||
|
.toc{background:var(--panel-2);border:1px solid var(--border);border-radius:12px;padding:14px 18px}
|
||||||
|
.toc ol{margin:6px 0 0;padding-right:20px}
|
||||||
|
.toc a{color:#a8c7ff;text-decoration:none}
|
||||||
|
.toc a:hover{text-decoration:underline}
|
||||||
|
table{width:100%;border-collapse:collapse;margin-top:10px;font-size:14px}
|
||||||
|
th,td{border:1px solid var(--border);padding:8px 10px;text-align:right;vertical-align:top}
|
||||||
|
th{background:#0c1830;color:#cfe0ff;font-weight:600}
|
||||||
|
tr:nth-child(even) td{background:rgba(255,255,255,.02)}
|
||||||
|
.grid{display:grid;grid-template-columns:1fr 1fr;gap:14px}
|
||||||
|
@media(max-width:820px){.grid{grid-template-columns:1fr}}
|
||||||
|
ul.clean{padding-right:20px;margin:6px 0}
|
||||||
|
ul.clean li{margin:4px 0}
|
||||||
|
.pill{display:inline-block;background:#0c1830;border:1px solid var(--border);
|
||||||
|
padding:2px 8px;border-radius:6px;font-size:12px;color:#b8cdf0;direction:ltr}
|
||||||
|
footer{margin-top:40px;color:var(--muted);font-size:12px;text-align:center}
|
||||||
|
.hl{background:linear-gradient(90deg,rgba(79,140,255,.15),transparent);padding:0 4px;border-radius:4px}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="wrap">
|
||||||
|
|
||||||
|
<!-- ============ HEADER ============ -->
|
||||||
|
<header class="hero">
|
||||||
|
<span class="badge">xIds</span>
|
||||||
|
<span class="badge ok">Dynamic Roles & Scopes</span>
|
||||||
|
<span class="badge warn">Proposed / Draft</span>
|
||||||
|
<h1>گزارش نشست — پیادهسازی <code>XRolesController</code> و سرویسهای تست</h1>
|
||||||
|
<p class="lead">
|
||||||
|
افزودن امکان تعریف داینامیک نقشها و Scopeها در <code>xIdentityService</code> و <code>xIdentityModels</code>،
|
||||||
|
و ایجاد کنترلر مدیریتی در <code>xIds</code> مشابه <code>XApplicationController</code> به همراه تستهای یکپارچه مشابه <code>AccountController+Tests</code>.
|
||||||
|
</p>
|
||||||
|
<div class="meta">
|
||||||
|
<span>📁 ماژول مرجع: <code>xCommons</code></span>
|
||||||
|
<span>🧩 پروژه هدف: <code>xIds</code></span>
|
||||||
|
<span>📅 ۲۰۲۶-۱۱-۲۶</span>
|
||||||
|
</div>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<!-- ============ TOC ============ -->
|
||||||
|
<section class="toc" aria-label="فهرست مطالب">
|
||||||
|
<strong>فهرست مطالب</strong>
|
||||||
|
<ol>
|
||||||
|
<li><a href="#summary">خلاصه و دامنه تغییرات</a></li>
|
||||||
|
<li><a href="#assumptions">پیشفرضها و فایلهای ناموجود</a></li>
|
||||||
|
<li><a href="#design">طراحی <code>XRolesController</code></a></li>
|
||||||
|
<li><a href="#controller-code">کد کامل <code>XRolesController</code></a></li>
|
||||||
|
<li><a href="#di">ثبت در Dependency Injection</a></li>
|
||||||
|
<li><a href="#tests">سرویسهای تست (XUnit + WebApplicationFactory)</a></li>
|
||||||
|
<li><a href="#next">گامهای بعدی و نکات همترازی</a></li>
|
||||||
|
</ol>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<!-- ============ 1. SUMMARY ============ -->
|
||||||
|
<h2 id="summary">۱) خلاصه و دامنه تغییرات</h2>
|
||||||
|
<div class="card info">
|
||||||
|
<p>
|
||||||
|
در ماژولهای <code>xIdentityService</code> و <code>xIdentityModels</code> پیادهسازی تعریف <b>داینامیک نقشها</b> و <b>Scopeها</b> اضافه شده و
|
||||||
|
ذخیرهسازی آنها در پروژه <code>xIds</code> (لایه دیتابیس) انجام گرفته است. اهداف این نشست:
|
||||||
|
</p>
|
||||||
|
<ul class="clean">
|
||||||
|
<li>ایجاد یک کنترلر در <code>xIds</code> با رفتار مشابه <code>XApplicationController</code> برای مدیریت نقشها/Scopeها.</li>
|
||||||
|
<li>استفاده از آنچه در <code>XAuthorizationProvider</code> بهعنوان نقش/Scope «قابل استفاده» تعریف شده.</li>
|
||||||
|
<li>پیادهسازی سرویسهای تست دقیقاً به الگوی <code>AccountController+Tests</code>.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="card">
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr><th>مورد</th><th>وضعیت</th><th>توضیح</th></tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<tr><td>مدل داینامیک Role/Scope</td><td><span class="pill">DONE (بنا به گفته شما)</span></td><td>در <code>xIdentityModels</code></td></tr>
|
||||||
|
<tr><td>سرویس داینامیک Role/Scope</td><td><span class="pill">DONE (بنا به گفته شما)</span></td><td>در <code>xIdentityService</code></td></tr>
|
||||||
|
<tr><td>لایه دیتابیس در <code>xIds</code></td><td><span class="pill">DONE (بنا به گفته شما)</span></td><td>DbContext / Repository</td></tr>
|
||||||
|
<tr><td>کنترلر <code>XRolesController</code></td><td><span class="pill">PROPOSED</span></td><td>در این گزارش پیشنهاد شده</td></tr>
|
||||||
|
<tr><td>تستهای <code>XRolesController</code></td><td><span class="pill">PROPOSED</span></td><td>الگوی AccountController+Tests</td></tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ============ 2. ASSUMPTIONS ============ -->
|
||||||
|
<h2 id="assumptions">۲) پیشفرضها و فایلهای ناموجود</h2>
|
||||||
|
<div class="card note">
|
||||||
|
<p>برای تولید کدِ دقیقِ «کپیبرداریشدنی»، به فایلهای زیر نیاز است که در این نشست ارسال نشدند:</p>
|
||||||
|
<ul class="clean">
|
||||||
|
<li><code>HTML_REPORT_TEMPLATE.txt</code> — قالب گزارش</li>
|
||||||
|
<li><code>XApplicationController.cs</code> — برای همترازی دقیق امضاها و مسیرها</li>
|
||||||
|
<li><code>XAuthorizationProvider.cs</code> — برای دانستن متدهای <code>GetRoles</code> / <code>GetScopes</code></li>
|
||||||
|
<li><code>AccountController.cs</code> و <code>AccountControllerTests.cs</code> — برای الگوی تست</li>
|
||||||
|
<li>سورس <code>xIdentityService</code> و <code>xIdentityModels</code> — برای نام دقیق DTOها و اینترفیسها</li>
|
||||||
|
</ul>
|
||||||
|
<p>
|
||||||
|
در ادامه از نامهای متعارف <code>IXIdentityService</code>، <code>CreateRoleRequest</code>، <code>RoleDto</code>،
|
||||||
|
<code>ScopeDto</code> استفاده شده است. این نامها را با نامهای واقعی خود جایگزین کنید.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ============ 3. DESIGN ============ -->
|
||||||
|
<h2 id="design">۳) طراحی <code>XRolesController</code></h2>
|
||||||
|
<p>کنترلر جدید از پایهی موجود در <code>xCommons</code> ارثبری میکند تا رفتارهای امنیتی (X-PoweredBy، ApiVersion، RateLimit، ExceptionToActionResult) رعایت شود:</p>
|
||||||
|
|
||||||
|
<div class="grid">
|
||||||
|
<div class="card ok">
|
||||||
|
<h3>ویژگیهای پایه (به ارثرسیده)</h3>
|
||||||
|
<ul class="clean">
|
||||||
|
<li><code>[ApiController]</code></li>
|
||||||
|
<li><code>[ApiVersion("1.0")]</code></li>
|
||||||
|
<li><code>[RequireXPowered(true)]</code></li>
|
||||||
|
<li><code>[Route("api/v{version:apiVersion}/[controller]")]</code></li>
|
||||||
|
<li>دسترسی به <code>Logger</code>، <code>AppConfiguration</code>، <code>ValidationProvider</code></li>
|
||||||
|
<li><code>GetExceptionActionResult(ex)</code> برای یکسانسازی خطاها</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="card">
|
||||||
|
<h3>Endpointهای پیشنهادی</h3>
|
||||||
|
<table>
|
||||||
|
<tr><th>متد</th><th>مسیر</th><th>توضیح</th></tr>
|
||||||
|
<tr><td>GET</td><td><code>/available</code></td><td>نقشهای تعریفشده در <code>XAuthorizationProvider</code></td></tr>
|
||||||
|
<tr><td>GET</td><td><code>/scopes/available</code></td><td>Scopeهای تعریفشده در <code>XAuthorizationProvider</code></td></tr>
|
||||||
|
<tr><td>GET</td><td><code>/</code></td><td>لیست نقشهای داینامیک DB</td></tr>
|
||||||
|
<tr><td>GET</td><td><code>/{id}</code></td><td>یک نقش</td></tr>
|
||||||
|
<tr><td>POST</td><td><code>/</code></td><td>ایجاد نقش</td></tr>
|
||||||
|
<tr><td>PUT</td><td><code>/{id}</code></td><td>ویرایش نقش</td></tr>
|
||||||
|
<tr><td>DELETE</td><td><code>/{id}</code></td><td>حذف نقش</td></tr>
|
||||||
|
<tr><td>GET/POST/PUT/DELETE</td><td><code>/scopes</code></td><td>معادل Scope (چرخه مشابه)</td></tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- ============ 4. CONTROLLER CODE ============ -->
|
||||||
|
<h2 id="controller-code">۴) کد کامل <code>XRolesController</code></h2>
|
||||||
|
<p>مسیر پیشنهادی: <span class="pill">xIds/Controllers/XRolesController.cs</span></p>
|
||||||
|
|
||||||
|
<pre><span class="c">// xIds/Controllers/XRolesController.cs</span>
|
||||||
|
<span class="k">using</span> System;
|
||||||
|
<span class="k">using</span> System.Threading.Tasks;
|
||||||
|
<span class="k">using</span> Microsoft.AspNetCore.Authorization;
|
||||||
|
<span class="k">using</span> Microsoft.AspNetCore.Mvc;
|
||||||
|
<span class="k">using</span> Microsoft.Extensions.Logging;
|
||||||
|
|
||||||
|
<span class="k">using</span> xCommons.Attributes;
|
||||||
|
<span class="k">using</span> xCommons.Constants;
|
||||||
|
<span class="k">using</span> xCommons.Controllers;
|
||||||
|
<span class="k">using</span> xCommons.Configurations;
|
||||||
|
<span class="k">using</span> xCommons.Providers;
|
||||||
|
|
||||||
|
<span class="k">using</span> xIdentityModels.DTOs; <span class="c">// CreateRoleRequest, UpdateRoleRequest, RoleDto, ScopeDto</span>
|
||||||
|
<span class="k">using</span> xIdentityService.Interfaces; <span class="c">// IXIdentityService</span>
|
||||||
|
<span class="k">using</span> xIdentityService.Authorization; <span class="c">// XAuthorizationProvider</span>
|
||||||
|
|
||||||
|
<span class="k">namespace</span> xIds.Controllers
|
||||||
|
{
|
||||||
|
[ApiVersion(<span class="s">"1.0"</span>)]
|
||||||
|
[Route(<span class="s">"api/v{version:apiVersion}/xroles"</span>)]
|
||||||
|
[RequireXPowered(<span class="k">true</span>)]
|
||||||
|
<span class="k">public</span> <span class="k">class</span> <span class="t">XRolesController</span> : XBaseApiV1Controller
|
||||||
|
{
|
||||||
|
<span class="k">private</span> <span class="k">readonly</span> IXIdentityService _identityService;
|
||||||
|
<span class="k">private</span> <span class="k">readonly</span> XAuthorizationProvider _authorizationProvider;
|
||||||
|
|
||||||
|
<span class="k">public</span> XRolesController(
|
||||||
|
ILogger logger,
|
||||||
|
XAppConfiguration appConfiguration,
|
||||||
|
XValidationProvider validationProvider,
|
||||||
|
IXIdentityService identityService,
|
||||||
|
XAuthorizationProvider authorizationProvider
|
||||||
|
) : <span class="k">base</span>(logger, appConfiguration, validationProvider)
|
||||||
|
{
|
||||||
|
_identityService = identityService;
|
||||||
|
_authorizationProvider = authorizationProvider;
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="c">// ----------------------------------------------------------
|
||||||
|
// 1) نقشهای تعریفشده در XAuthorizationProvider
|
||||||
|
// ----------------------------------------------------------</span>
|
||||||
|
[HttpGet(<span class="s">"available"</span>)]
|
||||||
|
[AllowAnonymous]
|
||||||
|
<span class="k">public</span> IActionResult GetAvailableRoles()
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
<span class="k">var</span> roles = _authorizationProvider.GetRoles();
|
||||||
|
<span class="k">return</span> Ok(roles);
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex)
|
||||||
|
{
|
||||||
|
<span class="k">return</span> GetExceptionActionResult(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="c">// ----------------------------------------------------------
|
||||||
|
// 2) Scopeهای تعریفشده در XAuthorizationProvider
|
||||||
|
// ----------------------------------------------------------</span>
|
||||||
|
[HttpGet(<span class="s">"scopes/available"</span>)]
|
||||||
|
[AllowAnonymous]
|
||||||
|
<span class="k">public</span> IActionResult GetAvailableScopes()
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
<span class="k">var</span> scopes = _authorizationProvider.GetScopes();
|
||||||
|
<span class="k">return</span> Ok(scopes);
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex)
|
||||||
|
{
|
||||||
|
<span class="k">return</span> GetExceptionActionResult(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="c">// ----------------------------------------------------------
|
||||||
|
// 3) نقشهای داینامیک ذخیرهشده در DB
|
||||||
|
// ----------------------------------------------------------</span>
|
||||||
|
[HttpGet]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> GetRoles()
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
<span class="k">var</span> roles = <span class="k">await</span> _identityService.GetRolesAsync();
|
||||||
|
<span class="k">return</span> Ok(roles);
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex)
|
||||||
|
{
|
||||||
|
<span class="k">return</span> GetExceptionActionResult(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpGet(<span class="s">"{id}"</span>)]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> GetRole(<span class="k">string</span> id)
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
<span class="k">var</span> role = <span class="k">await</span> _identityService.GetRoleAsync(id);
|
||||||
|
<span class="k">return</span> role == <span class="k">null</span> ? NotFound() : Ok(role);
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex)
|
||||||
|
{
|
||||||
|
<span class="k">return</span> GetExceptionActionResult(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="c">// ----------------------------------------------------------
|
||||||
|
// 4) CRUD نقش داینامیک
|
||||||
|
// ----------------------------------------------------------</span>
|
||||||
|
[HttpPost]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> CreateRole([FromBody] CreateRoleRequest request)
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
ValidationProvider.Validate(request);
|
||||||
|
<span class="k">var</span> result = <span class="k">await</span> _identityService.CreateRoleAsync(request);
|
||||||
|
<span class="k">return</span> CreatedAtAction(<span class="k">nameof</span>(GetRole), <span class="k">new</span> { id = result.Id }, result);
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex)
|
||||||
|
{
|
||||||
|
<span class="k">return</span> GetExceptionActionResult(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPut(<span class="s">"{id}"</span>)]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> UpdateRole(<span class="k">string</span> id, [FromBody] UpdateRoleRequest request)
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
ValidationProvider.Validate(request);
|
||||||
|
<span class="k">var</span> result = <span class="k">await</span> _identityService.UpdateRoleAsync(id, request);
|
||||||
|
<span class="k">return</span> Ok(result);
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex)
|
||||||
|
{
|
||||||
|
<span class="k">return</span> GetExceptionActionResult(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete(<span class="s">"{id}"</span>)]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> DeleteRole(<span class="k">string</span> id)
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
<span class="k">await</span> _identityService.DeleteRoleAsync(id);
|
||||||
|
<span class="k">return</span> NoContent();
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex)
|
||||||
|
{
|
||||||
|
<span class="k">return</span> GetExceptionActionResult(ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
<span class="c">// ----------------------------------------------------------
|
||||||
|
// 5) Scopeهای داینامیک — چرخه مشابه
|
||||||
|
// ----------------------------------------------------------</span>
|
||||||
|
[HttpGet(<span class="s">"scopes"</span>)]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> GetScopes()
|
||||||
|
{
|
||||||
|
<span class="k">try</span> { <span class="k">return</span> Ok(<span class="k">await</span> _identityService.GetScopesAsync()); }
|
||||||
|
<span class="k">catch</span> (Exception ex) { <span class="k">return</span> GetExceptionActionResult(ex); }
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpPost(<span class="s">"scopes"</span>)]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> CreateScope([FromBody] CreateScopeRequest request)
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
ValidationProvider.Validate(request);
|
||||||
|
<span class="k">var</span> result = <span class="k">await</span> _identityService.CreateScopeAsync(request);
|
||||||
|
<span class="k">return</span> CreatedAtAction(<span class="k">nameof</span>(GetScopes), <span class="k">new</span> { }, result);
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex) { <span class="k">return</span> GetExceptionActionResult(ex); }
|
||||||
|
}
|
||||||
|
|
||||||
|
[HttpDelete(<span class="s">"scopes/{id}"</span>)]
|
||||||
|
[Authorize]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task<IActionResult> DeleteScope(<span class="k">string</span> id)
|
||||||
|
{
|
||||||
|
<span class="k">try</span>
|
||||||
|
{
|
||||||
|
<span class="k">await</span> _identityService.DeleteScopeAsync(id);
|
||||||
|
<span class="k">return</span> NoContent();
|
||||||
|
}
|
||||||
|
<span class="k">catch</span> (Exception ex) { <span class="k">return</span> GetExceptionActionResult(ex); }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
|
||||||
|
<!-- ============ 5. DI ============ -->
|
||||||
|
<h2 id="di">۵) ثبت در Dependency Injection</h2>
|
||||||
|
<p>مشابه الگوی موجود در <code>XDIHelperExtension.AddXCommons</code>، در <code>Program.cs</code> پروژه <code>xIds</code>:</p>
|
||||||
|
<pre><span class="c">// Program.cs — xIds</span>
|
||||||
|
builder.Services.AddXCommons(builder.Configuration); <span class="c">// از xCommons</span>
|
||||||
|
builder.Services.AddXFileTypeDetector(builder.Configuration);
|
||||||
|
builder.Services.AddXApiV1Versioning();
|
||||||
|
builder.Services.AddXAppConfiguration(builder.Configuration, builder.Environment.EnvironmentName);
|
||||||
|
|
||||||
|
<span class="c">// سرویسهای داینامیک نقش/Scope</span>
|
||||||
|
builder.Services.AddScoped<IXIdentityService, XIdentityService>();
|
||||||
|
builder.Services.AddSingleton<XAuthorizationProvider>(); <span class="c">// یا Scoped، بسته به پیادهسازی شما</span>
|
||||||
|
|
||||||
|
<span class="c">// (اختیاری) CORS و RateLimit از xCommons</span>
|
||||||
|
builder.Services.AddXCors(builder.Configuration
|
||||||
|
.GetSection(<span class="s">"XAppConfiguration"</span>).Get<XAppConfiguration>().AllowedOrigins);
|
||||||
|
builder.Services.AddXRateLimit(builder.Configuration);
|
||||||
|
|
||||||
|
<span class="c">// ... سپس در app:</span>
|
||||||
|
<span class="c">// app.UseXCors();</span>
|
||||||
|
<span class="c">// app.UseAuthentication();</span>
|
||||||
|
<span class="c">// app.UseAuthorization();</span></pre>
|
||||||
|
|
||||||
|
<!-- ============ 6. TESTS ============ -->
|
||||||
|
<h2 id="tests">۶) سرویسهای تست — به سبک <code>AccountController+Tests</code></h2>
|
||||||
|
<p>
|
||||||
|
الگوی پیشنهادی همان الگوی <code>AccountControllerTests</code> است: <b>XUnit</b> + <b><code>WebApplicationFactory<Program></code></b> برای تستهای یکپارچه،
|
||||||
|
به همراه <code>Moq</code> برای تستهای واحدِ سرویس.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<h3>۶.۱) تست یکپارچه <code>XRolesControllerTests</code></h3>
|
||||||
|
<pre><span class="c">// xIds.Tests/Integration/XRolesControllerTests.cs</span>
|
||||||
|
<span class="k">using</span> System.Net;
|
||||||
|
<span class="k">using</span> System.Net.Http.Json;
|
||||||
|
<span class="k">using</span> System.Threading.Tasks;
|
||||||
|
<span class="k">using</span> Microsoft.AspNetCore.Mvc.Testing;
|
||||||
|
<span class="k">using</span> Xunit;
|
||||||
|
<span class="k">using</span> xIdentityModels.DTOs;
|
||||||
|
|
||||||
|
<span class="k">namespace</span> xIds.Tests.Integration
|
||||||
|
{
|
||||||
|
<span class="k">public</span> <span class="k">class</span> <span class="t">XRolesControllerTests</span> : IClassFixture<WebApplicationFactory<Program>>
|
||||||
|
{
|
||||||
|
<span class="k">private</span> <span class="k">readonly</span> HttpClient _client;
|
||||||
|
|
||||||
|
<span class="k">public</span> XRolesControllerTests(WebApplicationFactory<Program> factory)
|
||||||
|
{
|
||||||
|
_client = factory.CreateClient();
|
||||||
|
<span class="c">// هدر اجباری برای RequireXPowered</span>
|
||||||
|
_client.DefaultRequestHeaders.Add(<span class="s">"X-PoweredBy"</span>, <span class="s">"xIds-Test"</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task GetAvailableRoles_ReturnsOk()
|
||||||
|
{
|
||||||
|
<span class="c">// Act</span>
|
||||||
|
<span class="k">var</span> response = <span class="k">await</span> _client.GetAsync(<span class="s">"/api/v1/xroles/available"</span>);
|
||||||
|
|
||||||
|
<span class="c">// Assert</span>
|
||||||
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task GetAvailableScopes_ReturnsOk()
|
||||||
|
{
|
||||||
|
<span class="k">var</span> response = <span class="k">await</span> _client.GetAsync(<span class="s">"/api/v1/xroles/scopes/available"</span>);
|
||||||
|
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task GetRoles_WithoutAuth_ReturnsUnauthorized()
|
||||||
|
{
|
||||||
|
<span class="k">var</span> response = <span class="k">await</span> _client.GetAsync(<span class="s">"/api/v1/xroles"</span>);
|
||||||
|
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task CreateRole_WithInvalidPayload_ReturnsBadRequest()
|
||||||
|
{
|
||||||
|
<span class="c">// Arrange</span>
|
||||||
|
<span class="k">var</span> request = <span class="k">new</span> CreateRoleRequest { Name = <span class="s">""</span> };
|
||||||
|
|
||||||
|
<span class="c">// Act</span>
|
||||||
|
<span class="k">var</span> response = <span class="k">await</span> _client.PostAsJsonAsync(<span class="s">"/api/v1/xroles"</span>, request);
|
||||||
|
|
||||||
|
<span class="c">// Assert</span>
|
||||||
|
Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode); <span class="c">// بدون توکن؛ در تست واقعی با توکن، BadRequest انتظار میرود</span>
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task CreateRole_WithValidPayload_ReturnsCreated()
|
||||||
|
{
|
||||||
|
<span class="c">// Arrange</span>
|
||||||
|
<span class="k">var</span> request = <span class="k">new</span> CreateRoleRequest
|
||||||
|
{
|
||||||
|
Name = <span class="s">"DynamicRole_Test"</span>,
|
||||||
|
Description = <span class="s">"Created by integration test"</span>,
|
||||||
|
Scopes = <span class="k">new</span>[] { <span class="s">"xids.read"</span>, <span class="s">"xids.write"</span> }
|
||||||
|
};
|
||||||
|
|
||||||
|
<span class="c">// Act</span>
|
||||||
|
<span class="k">var</span> response = <span class="k">await</span> _client.PostAsJsonAsync(<span class="s">"/api/v1/xroles"</span>, request);
|
||||||
|
|
||||||
|
<span class="c">// Assert</span>
|
||||||
|
Assert.Equal(HttpStatusCode.Created, response.StatusCode);
|
||||||
|
<span class="k">var</span> dto = <span class="k">await</span> response.Content.ReadFromJsonAsync<RoleDto>();
|
||||||
|
Assert.NotNull(dto);
|
||||||
|
Assert.Equal(<span class="s">"DynamicRole_Test"</span>, dto.Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task DeleteRole_NonExisting_ReturnsNotFoundOrUnauthorized()
|
||||||
|
{
|
||||||
|
<span class="k">var</span> response = <span class="k">await</span> _client.DeleteAsync(<span class="s">"/api/v1/xroles/999999"</span>);
|
||||||
|
Assert.True(response.StatusCode == HttpStatusCode.Unauthorized
|
||||||
|
|| response.StatusCode == HttpStatusCode.NotFound);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
|
||||||
|
<h3>۶.۲) تست واحد <code>XAuthorizationProvider</code></h3>
|
||||||
|
<pre><span class="c">// xIds.Tests/Unit/XAuthorizationProviderTests.cs</span>
|
||||||
|
<span class="k">using</span> System.Linq;
|
||||||
|
<span class="k">using</span> Xunit;
|
||||||
|
<span class="k">using</span> xIdentityService.Authorization;
|
||||||
|
|
||||||
|
<span class="k">namespace</span> xIds.Tests.Unit
|
||||||
|
{
|
||||||
|
<span class="k">public</span> <span class="k">class</span> <span class="t">XAuthorizationProviderTests</span>
|
||||||
|
{
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">void</span> GetRoles_ReturnsConfiguredRoles()
|
||||||
|
{
|
||||||
|
<span class="c">// Arrange</span>
|
||||||
|
<span class="k">var</span> provider = <span class="k">new</span> XAuthorizationProvider();
|
||||||
|
|
||||||
|
<span class="c">// Act</span>
|
||||||
|
<span class="k">var</span> roles = provider.GetRoles();
|
||||||
|
|
||||||
|
<span class="c">// Assert</span>
|
||||||
|
Assert.NotNull(roles);
|
||||||
|
Assert.NotEmpty(roles);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">void</span> GetScopes_ContainsKnownScopes()
|
||||||
|
{
|
||||||
|
<span class="k">var</span> provider = <span class="k">new</span> XAuthorizationProvider();
|
||||||
|
<span class="k">var</span> scopes = provider.GetScopes();
|
||||||
|
|
||||||
|
Assert.NotNull(scopes);
|
||||||
|
Assert.Contains(scopes, s => s.Name == <span class="s">"xids.read"</span>);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">void</span> Role_And_Scope_AreComposedCorrectly()
|
||||||
|
{
|
||||||
|
<span class="k">var</span> provider = <span class="k">new</span> XAuthorizationProvider();
|
||||||
|
<span class="k">var</span> role = provider.GetRoles().FirstOrDefault();
|
||||||
|
|
||||||
|
Assert.NotNull(role);
|
||||||
|
Assert.False(<span class="k">string</span>.IsNullOrWhiteSpace(role.Name));
|
||||||
|
Assert.NotNull(role.Scopes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
|
||||||
|
<h3>۶.۳) تست واحد کنترلر با Mock</h3>
|
||||||
|
<pre><span class="c">// xIds.Tests/Unit/XRolesControllerUnitTests.cs</span>
|
||||||
|
<span class="k">using</span> System.Threading.Tasks;
|
||||||
|
<span class="k">using</span> Microsoft.AspNetCore.Mvc;
|
||||||
|
<span class="k">using</span> Microsoft.Extensions.Logging.Abstractions;
|
||||||
|
<span class="k">using</span> Moq;
|
||||||
|
<span class="k">using</span> Xunit;
|
||||||
|
<span class="k">using</span> xCommons.Configurations;
|
||||||
|
<span class="k">using</span> xCommons.Providers;
|
||||||
|
<span class="k">using</span> xIdentityModels.DTOs;
|
||||||
|
<span class="k">using</span> xIdentityService.Authorization;
|
||||||
|
<span class="k">using</span> xIdentityService.Interfaces;
|
||||||
|
<span class="k">using</span> xIds.Controllers;
|
||||||
|
|
||||||
|
<span class="k">namespace</span> xIds.Tests.Unit
|
||||||
|
{
|
||||||
|
<span class="k">public</span> <span class="k">class</span> <span class="t">XRolesControllerUnitTests</span>
|
||||||
|
{
|
||||||
|
<span class="k">private</span> <span class="k">readonly</span> Mock<IXIdentityService> _identityMock = <span class="k">new</span>();
|
||||||
|
<span class="k">private</span> <span class="k">readonly</span> XAuthorizationProvider _provider = <span class="k">new</span>();
|
||||||
|
|
||||||
|
<span class="k">private</span> XRolesController CreateSut() => <span class="k">new</span> XRolesController(
|
||||||
|
NullLogger.Instance,
|
||||||
|
<span class="k">new</span> XAppConfiguration { Name = <span class="s">"xIds.Tests"</span>, XPoweredValue = <span class="s">"test"</span> },
|
||||||
|
<span class="k">new</span> XValidationProvider(),
|
||||||
|
_identityMock.Object,
|
||||||
|
_provider
|
||||||
|
);
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">void</span> GetAvailableRoles_ReturnsOkObjectResult()
|
||||||
|
{
|
||||||
|
<span class="k">var</span> sut = CreateSut();
|
||||||
|
<span class="k">var</span> result = sut.GetAvailableRoles();
|
||||||
|
Assert.IsType<OkObjectResult>(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Fact]
|
||||||
|
<span class="k">public</span> <span class="k">async</span> Task GetRole_WhenServiceReturnsNull_ReturnsNotFound()
|
||||||
|
{
|
||||||
|
_identityMock.Setup(s => s.GetRoleAsync(<span class="s">"missing"</span>))
|
||||||
|
.ReturnsAsync((RoleDto)<span class="k">null</span>);
|
||||||
|
|
||||||
|
<span class="k">var</span> sut = CreateSut();
|
||||||
|
<span class="k">var</span> result = <span class="k">await</span> sut.GetRole(<span class="s">"missing"</span>);
|
||||||
|
|
||||||
|
Assert.IsType<NotFoundResult>(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}</pre>
|
||||||
|
|
||||||
|
<!-- ============ 7. NEXT ============ -->
|
||||||
|
<h2 id="next">۷) گامهای بعدی و نکات همترازی</h2>
|
||||||
|
<div class="card note">
|
||||||
|
<ul class="clean">
|
||||||
|
<li>نامهای واقعی متدهای <code>IXIdentityService</code> (مثلاً <code>GetRolesAsync</code> / <code>CreateRoleAsync</code>) را با این پیشنهادها همتراز کنید.</li>
|
||||||
|
<li>اگر <code>XAuthorizationProvider</code> در <code>xIdentityService</code> متدهای <code>GetRoles()</code> / <code>GetScopes()</code> ندارد، نام متدهای واقعی را جایگزین کنید.</li>
|
||||||
|
<li>برای <code>[Authorize]</code>، در تستهای یکپارچه از یک <b>Stub AuthenticationHandler</b> یا توکن تست معتبر استفاده کنید.</li>
|
||||||
|
<li>هدر <code>X-PoweredBy</code> در <code>RequireXPowered</code> با مقدار <code>XAppConfiguration.XPoweredValue</code> مقایسه میشود؛ در تستها آن را ست کنید.</li>
|
||||||
|
<li>اگر قالب <code>HTML_REPORT_TEMPLATE.txt</code> را ارسال کنید، ساختار این گزارش را دقیقاً با آن همتراز میکنم.</li>
|
||||||
|
<li>پیشنهاد میشود Endpointهای «available» با <code>[AllowAnonymous]</code> باقی بمانند تا کلاینتها بتوانند نقشها/Scopeهای مجاز را قبل از لاگین کشف کنند.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<footer>
|
||||||
|
گزارش تولیدشده بر پایه الگوهای <code>xCommons</code> — برای همترازی نهایی، سورسهای <code>XApplicationController</code>، <code>XAuthorizationProvider</code> و <code>AccountController+Tests</code> ارسال شود.
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,581 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fa" dir="rtl">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<title>نقشها و Scopeهای پویا در xIds</title>
|
||||||
|
<style>
|
||||||
|
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');
|
||||||
|
|
||||||
|
:root {
|
||||||
|
--primary: #1a365d;
|
||||||
|
--primary-light: #2c5282;
|
||||||
|
--accent: #c9a961;
|
||||||
|
--accent-dark: #a8893f;
|
||||||
|
--bg: #faf9f6;
|
||||||
|
--card-bg: #ffffff;
|
||||||
|
--text: #1a202c;
|
||||||
|
--text-muted: #4a5568;
|
||||||
|
--border: #e2e8f0;
|
||||||
|
--success: #38a169;
|
||||||
|
--danger: #e53e3e;
|
||||||
|
--warning: #dd6b20;
|
||||||
|
--shadow: 0 4px 6px rgba(0,0,0,0.05), 0 10px 30px rgba(26,54,93,0.08);
|
||||||
|
}
|
||||||
|
|
||||||
|
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||||||
|
|
||||||
|
body {
|
||||||
|
font-family: 'Vazirmatn', Tahoma, sans-serif;
|
||||||
|
background: var(--bg);
|
||||||
|
color: var(--text);
|
||||||
|
line-height: 1.9;
|
||||||
|
font-size: 15px;
|
||||||
|
padding: 30px 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-container {
|
||||||
|
max-width: 950px;
|
||||||
|
margin: 0 auto;
|
||||||
|
background: var(--card-bg);
|
||||||
|
box-shadow: var(--shadow);
|
||||||
|
border-radius: 12px;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-header {
|
||||||
|
background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
|
||||||
|
color: white;
|
||||||
|
padding: 50px 40px 40px;
|
||||||
|
position: relative;
|
||||||
|
border-bottom: 4px solid var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-header::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
top: 0; right: 0;
|
||||||
|
width: 200px; height: 200px;
|
||||||
|
background: radial-gradient(circle, rgba(201,169,97,0.15) 0%, transparent 70%);
|
||||||
|
border-radius: 50%;
|
||||||
|
transform: translate(50%, -50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.header-top {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 30px;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-badge {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.company-logo {
|
||||||
|
width: 60px; height: 60px;
|
||||||
|
background: var(--accent);
|
||||||
|
border-radius: 12px;
|
||||||
|
box-shadow: 0 4px 12px rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-meta {
|
||||||
|
text-align: left;
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.doc-meta div { margin-bottom: 3px; }
|
||||||
|
|
||||||
|
.document-title {
|
||||||
|
text-align: center;
|
||||||
|
position: relative;
|
||||||
|
z-index: 1;
|
||||||
|
padding: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-title .label {
|
||||||
|
display: inline-block;
|
||||||
|
background: rgba(201,169,97,0.2);
|
||||||
|
color: var(--accent);
|
||||||
|
padding: 4px 16px;
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 12px;
|
||||||
|
font-weight: 600;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
border: 1px solid rgba(201,169,97,0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-title h1 {
|
||||||
|
font-size: 28px;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
letter-spacing: -0.5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-title h2 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 400;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-body {
|
||||||
|
padding: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-text {
|
||||||
|
background: linear-gradient(to left, #f7fafc, #edf2f7);
|
||||||
|
border-right: 4px solid var(--accent);
|
||||||
|
padding: 20px 25px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-bottom: 35px;
|
||||||
|
font-size: 14px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section {
|
||||||
|
margin-bottom: 40px;
|
||||||
|
page-break-inside: avoid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-header {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 15px;
|
||||||
|
padding-bottom: 12px;
|
||||||
|
border-bottom: 2px solid var(--border);
|
||||||
|
margin-bottom: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-number {
|
||||||
|
width: 50px; height: 50px;
|
||||||
|
background: linear-gradient(135deg, var(--primary), var(--primary-light));
|
||||||
|
color: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-weight: 800;
|
||||||
|
font-size: 20px;
|
||||||
|
flex-shrink: 0;
|
||||||
|
box-shadow: 0 4px 10px rgba(26,54,93,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title { flex: 1; }
|
||||||
|
|
||||||
|
.section-title h3 {
|
||||||
|
font-size: 19px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--primary);
|
||||||
|
margin-bottom: 2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-title .subtitle {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-content {
|
||||||
|
padding-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-content p {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
text-align: justify;
|
||||||
|
text-indent: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.section-content p.no-indent { text-indent: 0; }
|
||||||
|
|
||||||
|
.highlight-box {
|
||||||
|
background: linear-gradient(to left, #fffaf0, #fef5e7);
|
||||||
|
border: 1px solid #f6e05e;
|
||||||
|
border-right: 4px solid var(--accent);
|
||||||
|
padding: 18px 22px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 20px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.highlight-box strong {
|
||||||
|
color: var(--accent-dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-box {
|
||||||
|
background: linear-gradient(to left, #ebf8ff, #e6f6ff);
|
||||||
|
border: 1px solid #90cdf4;
|
||||||
|
border-right: 4px solid var(--primary-light);
|
||||||
|
padding: 18px 22px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 20px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.success-box {
|
||||||
|
background: linear-gradient(to left, #f0fff4, #e6fffa);
|
||||||
|
border: 1px solid #9ae6b4;
|
||||||
|
border-right: 4px solid var(--success);
|
||||||
|
padding: 18px 22px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 20px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.warning-box {
|
||||||
|
background: linear-gradient(to left, #fffaf0, #fef5e7);
|
||||||
|
border: 1px solid #fbd38d;
|
||||||
|
border-right: 4px solid var(--warning);
|
||||||
|
padding: 18px 22px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 20px 0;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table {
|
||||||
|
width: 100%;
|
||||||
|
border-collapse: collapse;
|
||||||
|
margin: 20px 0;
|
||||||
|
background: white;
|
||||||
|
border-radius: 8px;
|
||||||
|
overflow: hidden;
|
||||||
|
box-shadow: 0 2px 8px rgba(0,0,0,0.05);
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table thead {
|
||||||
|
background: linear-gradient(135deg, var(--primary), var(--primary-light));
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table th {
|
||||||
|
padding: 14px 16px;
|
||||||
|
text-align: right;
|
||||||
|
font-weight: 600;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table td {
|
||||||
|
padding: 13px 16px;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.styled-table tbody tr:last-child td { border-bottom: none; }
|
||||||
|
.styled-table tbody tr:nth-child(even) { background: #f8fafc; }
|
||||||
|
|
||||||
|
.styled-table .highlight-row {
|
||||||
|
background: #fffaf0 !important;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: 1fr 1fr;
|
||||||
|
gap: 20px;
|
||||||
|
margin: 25px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card {
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 2px solid var(--border);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 20px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card.recommended {
|
||||||
|
border-color: var(--success);
|
||||||
|
background: linear-gradient(to left, #f0fff4, #e6fffa);
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card .card-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: -10px;
|
||||||
|
right: 20px;
|
||||||
|
background: var(--success);
|
||||||
|
color: white;
|
||||||
|
padding: 3px 12px;
|
||||||
|
border-radius: 15px;
|
||||||
|
font-size: 11px;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card h4 {
|
||||||
|
font-size: 16px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--primary);
|
||||||
|
margin-bottom: 15px;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
border-bottom: 2px solid var(--border);
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card.recommended h4 {
|
||||||
|
border-bottom-color: var(--success);
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card ul {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card ul li {
|
||||||
|
padding: 8px 0;
|
||||||
|
border-bottom: 1px solid var(--border);
|
||||||
|
font-size: 13px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
.comparison-card ul li:last-child { border-bottom: none; }
|
||||||
|
|
||||||
|
.comparison-card ul li .value {
|
||||||
|
font-weight: 600;
|
||||||
|
color: var(--primary);
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-box {
|
||||||
|
background: linear-gradient(135deg, #f7fafc, #edf2f7);
|
||||||
|
border-right: 4px solid var(--accent);
|
||||||
|
padding: 20px 25px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin: 20px 0;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-box::before {
|
||||||
|
content: '"';
|
||||||
|
position: absolute;
|
||||||
|
top: -10px;
|
||||||
|
right: 15px;
|
||||||
|
font-size: 60px;
|
||||||
|
color: var(--accent);
|
||||||
|
opacity: 0.3;
|
||||||
|
font-family: Georgia, serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-box p {
|
||||||
|
font-style: italic;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin-bottom: 10px;
|
||||||
|
text-indent: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quote-box .source {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
text-align: left;
|
||||||
|
font-style: normal;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(3, 1fr);
|
||||||
|
gap: 15px;
|
||||||
|
margin: 25px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card {
|
||||||
|
background: linear-gradient(135deg, var(--primary), var(--primary-light));
|
||||||
|
color: white;
|
||||||
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 4px 12px rgba(26,54,93,0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card .stat-value {
|
||||||
|
font-size: 24px;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
color: var(--accent);
|
||||||
|
line-height: 1.3;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stat-card .stat-label {
|
||||||
|
font-size: 12px;
|
||||||
|
opacity: 0.9;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline {
|
||||||
|
position: relative;
|
||||||
|
padding: 20px 0;
|
||||||
|
margin: 25px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline::before {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: 50%;
|
||||||
|
top: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 3px;
|
||||||
|
background: var(--border);
|
||||||
|
transform: translateX(50%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-item {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-item:nth-child(odd) {
|
||||||
|
flex-direction: row-reverse;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-content {
|
||||||
|
width: 45%;
|
||||||
|
background: #f8fafc;
|
||||||
|
border: 1px solid var(--border);
|
||||||
|
border-radius: 8px;
|
||||||
|
padding: 15px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-item:nth-child(odd) .timeline-content {
|
||||||
|
margin-left: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-item:nth-child(even) .timeline-content {
|
||||||
|
margin-right: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-dot {
|
||||||
|
position: absolute;
|
||||||
|
right: 50%;
|
||||||
|
top: 20px;
|
||||||
|
width: 16px;
|
||||||
|
height: 16px;
|
||||||
|
background: var(--accent);
|
||||||
|
border: 3px solid white;
|
||||||
|
border-radius: 50%;
|
||||||
|
transform: translateX(50%);
|
||||||
|
box-shadow: 0 2px 6px rgba(0,0,0,0.2);
|
||||||
|
z-index: 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-content h5 {
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--primary);
|
||||||
|
margin-bottom: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.timeline-content p {
|
||||||
|
font-size: 12px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
text-indent: 0 !important;
|
||||||
|
margin-bottom: 0 !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reference-list {
|
||||||
|
list-style: none;
|
||||||
|
padding: 0;
|
||||||
|
margin: 20px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reference-list li {
|
||||||
|
background: #f8fafc;
|
||||||
|
border-right: 3px solid var(--primary-light);
|
||||||
|
padding: 15px 20px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border-radius: 6px;
|
||||||
|
font-size: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reference-list li strong {
|
||||||
|
color: var(--primary);
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.reference-list li .ref-source {
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.conclusion-box {
|
||||||
|
background: linear-gradient(135deg, var(--primary), var(--primary-light));
|
||||||
|
color: white;
|
||||||
|
padding: 30px;
|
||||||
|
border-radius: 12px;
|
||||||
|
margin: 30px 0;
|
||||||
|
text-align: center;
|
||||||
|
box-shadow: 0 8px 20px rgba(26,54,93,0.3);
|
||||||
|
}
|
||||||
|
|
||||||
|
.conclusion-box h3 {
|
||||||
|
font-size: 22px;
|
||||||
|
font-weight: 800;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
color: var(--accent);
|
||||||
|
}
|
||||||
|
|
||||||
|
.conclusion-box p {
|
||||||
|
font-size: 14px;
|
||||||
|
line-height: 1.8;
|
||||||
|
text-indent: 0 !important;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.conclusion-box .highlight {
|
||||||
|
background: rgba(201,169,97,0.2);
|
||||||
|
padding: 15px 20px;
|
||||||
|
border-radius: 8px;
|
||||||
|
margin-top: 20px;
|
||||||
|
border: 1px solid rgba(201,169,97,0.4);
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-footer {
|
||||||
|
background: var(--primary);
|
||||||
|
color: white;
|
||||||
|
padding: 25px 40px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 12px;
|
||||||
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.document-footer .footer-brand {
|
||||||
|
font-weight: 700;
|
||||||
|
color: var(--accent);
|
||||||
|
margin-bottom: 5px;
|
||||||
|
font-size: 14px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.footer-divider {
|
||||||
|
width: 60px;
|
||||||
|
height: 2px;
|
||||||
|
background: var(--accent);
|
||||||
|
margin: 10px auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.page-info {
|
||||||
|
text-align: center;
|
||||||
|
padding: 15px;
|
||||||
|
font-size: 11px;
|
||||||
|
color: var(--text-muted);
|
||||||
|
border-top: 1px solid var(--border);
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media print {
|
||||||
|
body { background: white; padding: 0; }
|
||||||
|
.document-container { box-shadow: none; border-radius: 0; }
|
||||||
|
.section { page-break-inside: avoid; }
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 768px) {
|
||||||
|
.document-body { padding: 25px 20px; }
|
||||||
|
.document-header { padding: 30px 20px; }
|
||||||
|
.comparison-grid { grid-template-columns: 1fr; }
|
||||||
|
.stats-grid { grid-template-columns: 1fr; }
|
||||||
|
.header-top { flex-direction: column; gap: 15px; }
|
||||||
|
.doc-meta { text-align: center; }
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body><div class='document-container'><header class='document-header'><div class='doc-meta'>تاریخ: <bdi>1405-09-05</bdi> | نسخه: 1</div><div class='document-title'><h1>نقشها و Scopeهای پویا در xIds</h1><h2>اهداف نشست توسعه و معیارهای پذیرش</h2></div></header><main class='document-body'><div class='intro-text'>طبق شرح توسعهدهنده، تعریف پویای نقش و Scope در xIdentityService و xIdentityModels اضافه شده و لایهٔ پایگاه داده در xIds پیاده شده است. موضوع این نشست، دسترسی به همین قابلیتها از طریق کنترلر و آزمودن آنهاست.</div><section class='section'><h3>۱. کنترلر مدیریت مجوزها</h3><p>کنترلر جدید در xIds باید از الگوی XApplicationController برای مسیرها، ورودی، پاسخ و کنترل دسترسی پیروی کند. عملیات را از قرارداد قابل استفادهٔ XAuthorizationProvider انتخاب کنید؛ کنترلر نباید قواعد نقش و Scope یا منطق پایگاه داده را دوباره پیاده کند.</p></section><section class='section'><h3>۲. سرویسهای تست</h3><p>چیدمان، آمادهسازی داده و شیوهٔ فراخوانی سرویسها باید مطابق AccountController+Tests باشد. برای هر عملیات منتشرشده، نتیجهٔ درخواست مجاز، ورودی نامعتبر و درخواست فاقد مجوز بررسی شود. برای عملیات تغییردهنده، وضعیت ذخیرهشده نیز بررسی شود و دادهٔ تست از دادهٔ عملیاتی جدا بماند.</p></section><div class='info-box'><strong>معیار تحویل:</strong> ساخت موفق xIds، اجرای سرویسهای تست و ثبت نتیجهٔ هر سناریو. این سند اهداف نشست را ثبت میکند و گزارش موفقیت آزمون نیست.</div></main><footer class='document-footer'>مستند توسعه | xIds</footer></div></body></html>
|
||||||
+1256
File diff suppressed because it is too large
Load Diff
@@ -5180,6 +5180,95 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"/Authorization/Roles/{id}": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Authorization"
|
||||||
|
],
|
||||||
|
"summary": "Retrieve Specified Role By Id ...",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "id",
|
||||||
|
"in": "path",
|
||||||
|
"description": "",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "integer",
|
||||||
|
"format": "int32"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "X-PoweredBy",
|
||||||
|
"in": "header",
|
||||||
|
"description": "a Basic Authorization Filter",
|
||||||
|
"schema": {
|
||||||
|
"type": "String",
|
||||||
|
"default": "SaherElmITCenter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success",
|
||||||
|
"content": {
|
||||||
|
"application/json": {
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/components/schemas/XRoleDefinitionDto"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/Authorization/Test/Hi": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Authorization"
|
||||||
|
],
|
||||||
|
"summary": "Check the Controller Up and Running",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "X-PoweredBy",
|
||||||
|
"in": "header",
|
||||||
|
"description": "a Basic Authorization Filter",
|
||||||
|
"schema": {
|
||||||
|
"type": "String",
|
||||||
|
"default": "SaherElmITCenter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/Authorization/Test/PassRequireXPowered": {
|
||||||
|
"get": {
|
||||||
|
"tags": [
|
||||||
|
"Authorization"
|
||||||
|
],
|
||||||
|
"summary": "Check Controller ByPass XPowered Filter",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"name": "X-PoweredBy",
|
||||||
|
"in": "header",
|
||||||
|
"description": "a Basic Authorization Filter",
|
||||||
|
"schema": {
|
||||||
|
"type": "String",
|
||||||
|
"default": "SaherElmITCenter"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "Success"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"/": {
|
"/": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
@@ -6364,17 +6453,17 @@
|
|||||||
"memberType": {
|
"memberType": {
|
||||||
"$ref": "#/components/schemas/MemberTypes"
|
"$ref": "#/components/schemas/MemberTypes"
|
||||||
},
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"nullable": true,
|
||||||
|
"readOnly": true
|
||||||
|
},
|
||||||
"declaringType": {
|
"declaringType": {
|
||||||
"$ref": "#/components/schemas/Type"
|
"$ref": "#/components/schemas/Type"
|
||||||
},
|
},
|
||||||
"reflectedType": {
|
"reflectedType": {
|
||||||
"$ref": "#/components/schemas/Type"
|
"$ref": "#/components/schemas/Type"
|
||||||
},
|
},
|
||||||
"name": {
|
|
||||||
"type": "string",
|
|
||||||
"nullable": true,
|
|
||||||
"readOnly": true
|
|
||||||
},
|
|
||||||
"module": {
|
"module": {
|
||||||
"$ref": "#/components/schemas/Module"
|
"$ref": "#/components/schemas/Module"
|
||||||
},
|
},
|
||||||
@@ -8934,6 +9023,50 @@
|
|||||||
},
|
},
|
||||||
"additionalProperties": false
|
"additionalProperties": false
|
||||||
},
|
},
|
||||||
|
"XRoleDefinitionDto": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Entity Id",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"deleted": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Provided Soft Delete Behaviour ..."
|
||||||
|
},
|
||||||
|
"name": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Unique Normalized Role Name, e.g. chief_clerk ...",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"displayName": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Persian Display Name, e.g. سر دبیر ...",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"weight": {
|
||||||
|
"type": "integer",
|
||||||
|
"description": "Role Weight, same as XUserRole enum (user=0 ... admin=10) ...",
|
||||||
|
"format": "int32"
|
||||||
|
},
|
||||||
|
"parentRoleName": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Optional Parent Role for Inheritance ...",
|
||||||
|
"nullable": true
|
||||||
|
},
|
||||||
|
"isEnabled": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Is Enabled ..."
|
||||||
|
},
|
||||||
|
"isSystem": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Seeded from Constants, cannot be removed ..."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"additionalProperties": false,
|
||||||
|
"description": "a Role Definition Model (mirror of ASP.NET IdentityRole + Weight) ..."
|
||||||
|
},
|
||||||
"XRotateApiKeyRequest": {
|
"XRotateApiKeyRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
# Arion Hub
|
||||||
|
|
||||||
|
https://arionhub.pro/v1
|
||||||
|
sk-AKJGD8J9gOCrQgc5oWPGtRGUo25PnnQGnMoipzdliYHa3otZ
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
در ماژول های xIdentityService و xIdentityModels پیاده سازی امکان تعریف نقش ها و Scope ها بصورت داینامیک را اضافه کرده ام و در پروژه xIds پیاده سازی دیتابیس اون انجام شده.
|
||||||
|
اهداف من از این نشست:
|
||||||
|
1- در پروژه xIds یک کنترلر ایجاد کنی که دقیقا مشابه XApplicationController که کاربر بتونه نقش ها و موارد لازم رو که در XAuthorizationProvider تعریف شده و قابل استفاده است رو مورد کاربرد قرار بده.
|
||||||
|
2- سرویس های تست رو دقیقا مشابه آنچه در AccountController+Tests انجام دادم پیاده سازی کنی.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+1
-1
Submodule Modules/xCommons updated: 6757b2eaf6...2970815270
+1
-1
Submodule Modules/xIdentityService updated: 4e114aa85a...bdc8791822
+1
-1
Submodule xIds updated: 869a0476a0...384cffac36
Reference in New Issue
Block a user