This repository has been archived by the owner on Jul 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathroleadmin.html
92 lines (81 loc) · 3.16 KB
/
roleadmin.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>UGACSCF System Registration Page</title>
<meta name="description" content="Registration Page">
<meta name="viewport" content="width=device-width">
<script type="text/javascript" src="js/jquery-1.11.3.min.js"></script>
<script type="text/javascript" src="js/parse-latest.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<script type="text/javascript" src="js/HeaderFooter.js"></script>
</head>
<body>
<div id="header"></div>
<div id="main">
<h1>UGACSCF Registration </h1>
<form id="submitRole" method="post">
<div class="form-group">
<label for="roleName">Role Name:</label>
<input type="text" class="form-control" id="roleName" placeholder="Role Name">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" placeholder="****">
</div>
<div class="form-group">
<label for="emailInput">Email address</label>
<input type="email" class="form-control" id="emailInput" placeholder="[email protected]">
</div>
<button type="submit" id="signUpButton" class="btn btn-default">Register</button>
</form>
<div style="display:none" class="error">
Looks like there was a problem with register. Try again. If this occur again, please email <a href="mailto:[email protected]">[email protected]</a>
</div>
<div style="display:none" id="successbox" class="success">
<p>Congratulation! You successfully registered.</p>
</div>
</div>
<script type="text/javascript">
Parse.initialize("zcsUN6L48qEuivCDRYVIRZMPbcAL3uXmidyCXhtH", "bZTUGGQ37ZMLvOp2baAxyHMirE4H0Kudz7fxMVqv");
function createRole() {
var roleACL = new Parse.ACL();
roleACL.setWriteAccess(Parse.User.current(), true);
roleACL.setPublicReadAccess(true);
var role = new Parse.Role("Administrator", roleACL);
role.getUsers().add(Parse.User.current());
role.save(null, {
success: function(saveObject) {
// The object was saved successfully.
alert('role creation done');
updateRoleACL(saveObject);
},
error: function(saveObject, error) {
// The save failed.
window.alert("Failed creating role with error: " + error.code + ":" + error.message);
//assignRoles();
}
});
}
function updateRoleACL(role) {
var roleACL = role.getACL();
roleACL.setWriteAccess(Parse.User.current(), false);
roleACL.setRoleWriteAccess(role, true);
role.save(null, {
success: function(saveObject) {
// The object was saved successfully.
alert('role acl updated');
getUser();
},
error: function(saveObject, error) {
// The save failed.
window.alert("Failed updating role with error: " + error.code + ":" + error.message);
}
})
}
</script>
</body>
<div id="footer" class="text-muted"></div>
</html>