Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- :local postusername "bayan";
- :local postprofile "150K";
- # search profile in RADIUS for save to variable
- :do {
- :local e ([/user-manager/profile get [find name=$postprofile] name]);
- } on-error={:set e "error"};
- }
- # old user & profile for roolback userprofile
- :local oldUser ([/user-manager/user-profile get [find user=$postusername] user]);
- :local oldProfile ([/user-manager/user-profile get [find user=$postusername] profile]);
- # remove profile & session
- /user-manager/user-profile remove [find user=$postusername];
- /user-manager/session remove [find user=$postusername];
- # if profile in RADIUS found OR same postProfile DO
- :if ($profileRadius = $postprofile) do={
- /user-manager/user-profile add user=$postusername profile=$postprofile;
- :local newUserProfile ([/user-manager/user-profile get [find user=$postusername] user]);
- :put $newUserProfile;
- } else={
- # error: roolback userprofile
- /user-manager/user-profile add user=$oldUser profile=$oldProfile;
- :put "error roolback userprofile";
- }
- }
- {
- :do {
- :local pp ([/user-manager/profile get [find name=100K] name])
- } on-error={:put "error"}
- :put $pp
- }
- {
- :local pp "150K";
- :do {
- :local profilex ([/user-manager/profile get [find name=$pp] name]);
- } on-error={:set $profilex "profile_not_found"};
- :put $profilex;
- }
- {
- :local var1 "sip1"
- :local var2 "sip"
- :if (($var1 = "sip1") && ($var2 = "sip")) do={
- :put "ok"
- } else={
- :put "tidak ok"
- }
- }
- # {
- # :local olduname ([/user-manager/user-profile get [find user='.$username.'] user]);
- # :local oldprof ([/user-manager/user-profile get [find user='.$username.'] profile]);
- # /user-manager/user-profile remove [find user='.$username.'];
- # /user-manager/session remove [find user='.$username.'];
- # /user-manager/user-profile add user='.$username.' profile='.$profile.';
- # :local uname ([/user-manager/user-profile get [find user='.$username.'] user]);
- # :local prof ([/user-manager/user-profile get [find user='.$username.'] profile]);
- # :put ("$uname")
- # }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement