File tree 3 files changed +4
-5
lines changed
Controllers/ApiControllers
3 files changed +4
-5
lines changed Original file line number Diff line number Diff line change 13
13
14
14
namespace Zenergy . Controllers . ApiControllers
15
15
{
16
+ [ Authorize ]
16
17
public class membersController : ApiController
17
18
{
18
19
private ZenergyContext db = new ZenergyContext ( ) ;
Original file line number Diff line number Diff line change 14
14
15
15
namespace Zenergy . Controllers . ApiControllers
16
16
{
17
+ [ Authorize ]
17
18
public class usersController : ApiController
18
19
{
19
20
private ZenergyContext db = new ZenergyContext ( ) ;
@@ -25,14 +26,12 @@ public usersController()
25
26
}
26
27
27
28
// GET: api/users
28
- [ Authorize ]
29
29
public IQueryable < user > Getuser ( )
30
30
{
31
31
return db . user ;
32
32
}
33
33
34
34
// GET: api/users/5
35
- //[Authorize(Roles = "Admin")]
36
35
[ ResponseType ( typeof ( user ) ) ]
37
36
public async Task < IHttpActionResult > Getuser ( int id )
38
37
{
@@ -55,7 +54,6 @@ public async Task<IHttpActionResult> findByMail(string userMail)
55
54
{
56
55
return NotFound ( ) ;
57
56
}
58
-
59
57
return Ok ( user ) ;
60
58
}
61
59
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwner
51
51
identity . AddClaim ( new Claim ( "mail" , context . UserName ) ) ;
52
52
identity . AddClaim ( new Claim ( "role" , "user" ) ) ;
53
53
identity . AddClaim ( new Claim ( ClaimTypes . Name , context . UserName ) ) ;
54
- /*
54
+
55
55
if ( user . member != null )
56
56
{
57
57
identity . AddClaim ( new Claim ( ClaimTypes . Role , "Member" ) ) ;
@@ -67,7 +67,7 @@ public override async Task GrantResourceOwnerCredentials(OAuthGrantResourceOwner
67
67
if ( user . admin != null )
68
68
{
69
69
identity . AddClaim ( new Claim ( ClaimTypes . Role , "Admin" ) ) ;
70
- } */
70
+ }
71
71
72
72
AuthenticationProperties properties = CreateProperties ( user . mail ) ;
73
73
AuthenticationTicket ticket = new AuthenticationTicket ( identity , properties ) ;
You can’t perform that action at this time.
0 commit comments